summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST/ASTImporterTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r--clang/unittests/AST/ASTImporterTest.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index a4c823008d9..02020e6fa23 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -1797,5 +1797,38 @@ TEST(ImportExpr, UnresolvedMemberExpr) {
compoundStmt(has(callExpr(has(unresolvedMemberExpr())))))))));
}
+struct DeclContextTest : ASTImporterTestBase {};
+
+TEST_P(DeclContextTest, removeDeclOfClassTemplateSpecialization) {
+ Decl *TU = getTuDecl(
+ R"(
+ namespace NS {
+
+ template <typename T>
+ struct S {};
+ template struct S<int>;
+
+ inline namespace INS {
+ template <typename T>
+ struct S {};
+ template struct S<int>;
+ }
+
+ }
+ )", Lang_CXX11, "input0.cc");
+ auto *NS = FirstDeclMatcher<NamespaceDecl>().match(
+ TU, namespaceDecl());
+ auto *Spec = FirstDeclMatcher<ClassTemplateSpecializationDecl>().match(
+ TU, classTemplateSpecializationDecl());
+ ASSERT_TRUE(NS->containsDecl(Spec));
+
+ NS->removeDecl(Spec);
+ EXPECT_FALSE(NS->containsDecl(Spec));
+}
+
+INSTANTIATE_TEST_CASE_P(
+ ParameterizedTests, DeclContextTest,
+ ::testing::Values(ArgVector(), ArgVector{"-fdelayed-template-parsing"}),);
+
} // end namespace ast_matchers
} // end namespace clang
OpenPOWER on IntegriCloud