Skip to content

Commit 6cd7974

Browse files
Merge pull request #84405 from nate-chandler/rdar160692694
[DiagnoseStaticExclusivity] Fix this assertion.
2 parents 0730b91 + edf41ce commit 6cd7974

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/SILOptimizer/Mandatory/DiagnoseStaticExclusivity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ static StringRef extractExprText(const Expr *E, SourceManager &SM) {
336336
/// it is in the ifndef.
337337
#ifndef NDEBUG
338338
static bool isCallToStandardLibrarySwap(CallExpr *CE, ASTContext &Ctx) {
339-
if (CE->getCalledValue() == Ctx.getSwap())
339+
if (CE->getCalledValue(/*skipFunctionConversions=*/true) == Ctx.getSwap())
340340
return true;
341341

342342
// Is the call module qualified, i.e. Swift.swap(&a[i], &[j)?
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %target-swift-frontend \
2+
// RUN: -c \
3+
// RUN: -verify \
4+
// RUN: -disable-availability-checking \
5+
// RUN: -swift-version 6 \
6+
// RUN: %s
7+
8+
typealias A = InlineArray<2, UInt64>
9+
func mix(_ a: inout A) {
10+
swap(&a[0], &a[1]) // expected-error{{overlapping accesses}}
11+
// expected-note@-1{{conflicting access}}
12+
}

0 commit comments

Comments
 (0)