diff options
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r-- | clang/unittests/AST/ASTImporterTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 7cac2b57036..952e6f92db8 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -5083,6 +5083,24 @@ TEST_P(ASTImporterOptionSpecificTestBase, EXPECT_FALSE(ImportedD->getUnderlyingType()->isIncompleteType()); } +TEST_P(ASTImporterOptionSpecificTestBase, ImportTemplateParameterLists) { + auto Code = + R"( + template<class T> + int f() { return 0; } + template <> int f<int>() { return 4; } + )"; + + Decl *FromTU = getTuDecl(Code, Lang_CXX); + auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, + functionDecl(hasName("f"), isExplicitTemplateSpecialization())); + ASSERT_EQ(FromD->getNumTemplateParameterLists(), 1); + + auto *ToD = Import(FromD, Lang_CXX); + // The template parameter list should exist. + EXPECT_EQ(ToD->getNumTemplateParameterLists(), 1); +} + struct ASTImporterLookupTableTest : ASTImporterOptionSpecificTestBase {}; TEST_P(ASTImporterLookupTableTest, OneDecl) { |