Skip to content

Commit 8746d04

Browse files
committed
[cxx-interop] Define implict constructor on the definition.
Make sure that we define a C++ record's implicit constructor on the record's definition, not just on a declaration.
1 parent 7ac1b81 commit 8746d04

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3539,7 +3539,7 @@ namespace {
35393539
decl->needsImplicitDefaultConstructor()) {
35403540
clang::CXXConstructorDecl *ctor =
35413541
clangSema.DeclareImplicitDefaultConstructor(
3542-
const_cast<clang::CXXRecordDecl *>(decl));
3542+
const_cast<clang::CXXRecordDecl *>(decl->getDefinition()));
35433543
if (!ctor->isDeleted())
35443544
clangSema.DefineImplicitDefaultConstructor(clang::SourceLocation(),
35453545
ctor);

test/Interop/Cxx/class/nested-records-module-interface.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@
5858

5959
// CHECK: struct HasForwardDeclaredNestedType {
6060
// CHECK: struct NormalSubType {
61+
// CHECK: init()
6162
// CHECK: }
6263
// CHECK: struct ForwardDeclaredType {
64+
// CHECK: init()
6365
// CHECK: }
66+
// CHECK: init()
6467
// CHECK: }

0 commit comments

Comments
 (0)