Skip to content

Commit 8ec7bdf

Browse files
authored
Merge pull request #34429 from zoecarver/cxx/skip-unkown-constructor-names
2 parents f72afc8 + d843279 commit 8ec7bdf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/ClangImporter/ImportName.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,9 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
15951595
auto ctor = dyn_cast<clang::CXXConstructorDecl>(D);
15961596
if (auto templateCtor = dyn_cast<clang::FunctionTemplateDecl>(D))
15971597
ctor = cast<clang::CXXConstructorDecl>(templateCtor->getAsFunction());
1598-
assert(ctor && "Unkown decl with CXXConstructorName.");
1598+
// If we couldn't find a constructor decl, bail.
1599+
if (!ctor)
1600+
return ImportedName();
15991601
addEmptyArgNamesForClangFunction(ctor, argumentNames);
16001602
break;
16011603
}

test/Interop/Cxx/class/Inputs/constructors.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,9 @@ struct EmptyStruct {};
4343
struct IntWrapper {
4444
int x;
4545
};
46+
47+
// TODO: we should be able to import this constructor correctly. Until we can,
48+
// make sure not to crash.
49+
struct UsingBaseConstructor : ConstructorWithParam {
50+
using ConstructorWithParam::ConstructorWithParam;
51+
};

0 commit comments

Comments
 (0)