Skip to content

Commit 6aa662b

Browse files
committed
added test that reproduces the problem
1 parent 0694ea3 commit 6aa662b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

clang/unittests/AST/ASTImporterTest.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9986,6 +9986,34 @@ TEST_P(ImportTemplateParmDeclDefaultValue, InvisibleInheritedFrom) {
99869986
ToFDef->getTemplateParameters()->getParam(0));
99879987
}
99889988

9989+
TEST_P(ImportTemplateParmDeclDefaultValue, DefValImportError) {
9990+
const char *ToCode =
9991+
R"(
9992+
class X {
9993+
int A;
9994+
};
9995+
)";
9996+
getToTuDecl(ToCode, Lang_CXX14);
9997+
9998+
const char *FromCode =
9999+
R"(
10000+
class X;
10001+
10002+
template <typename P = X>
10003+
void f() {}
10004+
10005+
class X {
10006+
char A;
10007+
};
10008+
)";
10009+
TranslationUnitDecl *FromTU = getTuDecl(FromCode, Lang_CXX14);
10010+
auto *FromF = FirstDeclMatcher<FunctionTemplateDecl>().match(
10011+
FromTU, functionTemplateDecl(hasName("f")));
10012+
10013+
auto *ToFImported = Import(FromF, Lang_CXX14);
10014+
EXPECT_FALSE(ToFImported);
10015+
}
10016+
998910017
TEST_P(ImportTemplateParmDeclDefaultValue, ImportFunctionTemplate) {
999010018
TranslationUnitDecl *FromTU = getTuDecl(CodeFunction, Lang_CXX14);
999110019
auto *D3 = LastDeclMatcher<FunctionTemplateDecl>().match(

0 commit comments

Comments
 (0)