Skip to content

Commit e47002b

Browse files
authored
Merge pull request #72165 from DougGregor/so-many-pointees
Cope with the possibility of overloaded "pointee" members
2 parents 3364648 + 59d1846 commit e47002b

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

lib/AST/ASTContext.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,16 +1109,24 @@ static VarDecl *getPointeeProperty(VarDecl *&cache,
11091109
// There must be a property named "pointee".
11101110
auto identifier = ctx.getIdentifier("pointee");
11111111
auto results = nominal->lookupDirect(identifier);
1112-
if (results.size() != 1) return nullptr;
1112+
for (auto result : results) {
1113+
// The property must have type T.
1114+
auto *property = dyn_cast<VarDecl>(result);
1115+
if (!property)
1116+
continue;
11131117

1114-
// The property must have type T.
1115-
auto *property = dyn_cast<VarDecl>(results[0]);
1116-
if (!property) return nullptr;
1117-
if (!property->getInterfaceType()->isEqual(sig.getGenericParams()[0]))
1118-
return nullptr;
1118+
if (!property->getInterfaceType()->isEqual(sig.getGenericParams()[0]))
1119+
continue;
11191120

1120-
cache = property;
1121-
return property;
1121+
if (property->getFormalAccess() != AccessLevel::Public)
1122+
continue;
1123+
1124+
cache = property;
1125+
return property;
1126+
}
1127+
1128+
llvm_unreachable("Could not find pointee property");
1129+
return nullptr;
11221130
}
11231131

11241132
VarDecl *

test/Interop/Cxx/class/move-only/move-only-cxx-value-type.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=upcoming-swift)
22
// RUN: %target-run-simple-swift(-I %S/Inputs/ -cxx-interoperability-mode=swift-6 -O)
33

4-
// XFAIL: noncopyable_generics
5-
64
//
75
// REQUIRES: executable_test
86

0 commit comments

Comments
 (0)