================ @@ -9342,6 +9342,38 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportConflictTypeAliasTemplate) { EXPECT_FALSE(ImportedCallable); } +AST_MATCHER(ClassTemplateSpecializationDecl, hasInstantiatedFromMember) { + if (auto Instantiate = Node.getInstantiatedFrom()) { + if (auto *FromPartialSpecialization = + Instantiate.get<ClassTemplatePartialSpecializationDecl *>()) { + return nullptr != FromPartialSpecialization->getInstantiatedFromMember(); + } + } + return false; +} + +TEST_P(ASTImporterOptionSpecificTestBase, ImportInstantiatedFromMember) { + const char *Code = + R"( + template <typename> struct B { + template <typename, bool = false> union D; + template <typename T> union D<T> {}; + D<int> d; + }; + B<int> b; + )"; + Decl *FromTU = getTuDecl(Code, Lang_CXX11); + auto *FromA = FirstDeclMatcher<ClassTemplateSpecializationDecl>().match( + FromTU, classTemplateSpecializationDecl(hasName("D"), + hasInstantiatedFromMember())); + auto *FromPartialSpecialization = + cast<ClassTemplatePartialSpecializationDecl *>( + FromA->getInstantiatedFrom()); ---------------- balazske wrote:
```suggestion FromD->getInstantiatedFrom()); ``` https://github.com/llvm/llvm-project/pull/76493 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits