File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed
test/Interop/Cxx/class/inheritance Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -2197,6 +2197,13 @@ namespace {
21972197 // FIXME: Figure out what to do with superclasses in C++. One possible
21982198 // solution would be to turn them into members and add conversion
21992199 // functions.
2200+ if (auto cxxRecordDecl = dyn_cast<clang::CXXRecordDecl>(decl)) {
2201+ for (auto base : cxxRecordDecl->bases ()) {
2202+ if (auto *baseRecordDecl = base.getType ()->getAsCXXRecordDecl ()) {
2203+ Impl.importDecl (baseRecordDecl, getVersion ());
2204+ }
2205+ }
2206+ }
22002207
22012208 // Import each of the members.
22022209 SmallVector<VarDecl *, 4 > members;
Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ module Polymorphism {
1111 requires cplusplus
1212}
1313
14+ module ReferenceToDerived {
15+ header "reference-to-derived.h"
16+ requires cplusplus
17+ }
18+
1419module SubTypes {
1520 header "sub-types.h"
1621}
Original file line number Diff line number Diff line change 1+ class E ;
2+
3+ class C {
4+ public:
5+ E *getE () const ;
6+ };
7+
8+ class D : public C {};
9+
10+ class E : public D {
11+ public:
12+ D *getD () const ;
13+ };
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-emit-ir -I %S/Inputs -enable-experimental-cxx-interop %s -validate-tbd-against-ir=none
2+ // We should not fail with a circular reference error here.
3+
4+ import ReferenceToDerived
5+
6+ func foo( _ x: D ) { }
You canβt perform that action at this time.
0 commit comments