[clang] [clang][ASTImporter] Not using primary context in lookup table (PR #118466)
Michael Buch via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 18 04:29:20 PST 2024
================
@@ -10181,6 +10184,151 @@ TEST_P(ImportTemplateParmDeclDefaultValue,
FromD, FromDInherited);
}
+TEST_P(ASTImporterOptionSpecificTestBase, ImportIntoReopenedNamespaceNoMatch1) {
+ const char *ToCode =
+ R"(
+ namespace a {
+ }
+ namespace a {
+ struct X { int A; };
+ }
+ )";
+ Decl *ToTU = getToTuDecl(ToCode, Lang_CXX11);
+ const char *Code =
+ R"(
+ namespace a {
+ struct X { char A; };
+ }
+ )";
+ Decl *FromTU = getTuDecl(Code, Lang_CXX11);
+ auto *FromX = FirstDeclMatcher<CXXRecordDecl>().match(
+ FromTU, cxxRecordDecl(hasName("X")));
+ auto *ImportedX = Import(FromX, Lang_CXX11);
+ EXPECT_FALSE(ImportedX);
----------------
Michael137 wrote:
So this would've succeeded in the past? I guess because the primary context would've just return the empty namespace `a` of the `ToTU`, so the importer didn't see any conflicts. Am I understanding this correctly?
https://github.com/llvm/llvm-project/pull/118466
More information about the cfe-commits
mailing list