vsapsai added a comment. For the record, DR154: Anonymous unions in unnamed namespaces <http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#154> is relevant here.
================ Comment at: Sema/SemaDecl.cpp:4654-4656 + while (OwnerScope->getDeclKind() == Decl::LinkageSpec) { + OwnerScope = OwnerScope->getParent(); + } ---------------- Looks like `DeclContext::isTransparentContext()` might be relevant here. At least I was able to get the assertion failure > Assertion failed: (II && "Attempt to mangle unnamed decl."), function > getMangledNameImpl, file llvm-project/clang/lib/CodeGen/CodeGenModule.cpp, > line 913. for ```lang=c++ // clang -std=c++17 -fmodules-ts test-modules.cpp export module M; export { union { int int_val; float float_val; }; } ``` Also based on `isTransparentContext()` usage, inline namespaces can cause problems. Currently, there are no problems, we have the error > error: anonymous unions at namespace or global scope must be declared 'static' and there are no negative consequences (as far as I can tell). According to my bad standard knowledge that should be OK (haven't found non-static anonymous unions to be allowed in this case). ================ Comment at: Sema/SemaDecl.cpp:4659 if (DS.getStorageClassSpec() != DeclSpec::SCS_static && - (isa<TranslationUnitDecl>(Owner) || - (isa<NamespaceDecl>(Owner) && - cast<NamespaceDecl>(Owner)->getDeclName()))) { + (isa<TranslationUnitDecl>(OwnerScope) || + (isa<NamespaceDecl>(OwnerScope) && ---------------- Checked if we need to do the same change s/Owner/OwnerScope/ elsewhere in this method and looks like it is not required. We care if the owner is a Record and we don't allow linkage specification in classes, so skipping linkage scopes doesn't give us anything. Repository: rC Clang https://reviews.llvm.org/D45884 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits