[PATCH] D112903: [C++20] [Module] Fix front end crashes when trying to export a qualified entity which is already declared
Nathan Sidwell via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 11 06:08:27 PST 2021
urnathan added inline comments.
================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:7784-7785
"because namespace %1 does not enclose namespace %2">;
+def err_export_non_namespace_scope_name : Error<"cannot export %0 here since "
+ "only the entities in namespace scope could be exported.">;
+def err_export_qualified_redeclaration : Error<"cannot export redeclaration "
----------------
I think the wording is awkward. 'here' carries the implication there is a somewhere where it would be ok, but there isn't.
'cannot export %0 as it is not at namespace scope'
================
Comment at: clang/test/CXX/module/module.interface/p6.cpp:47
+void A::foo();
+export struct A::X; // expected-error {{cannot export redeclaration 'X' here.}}
+export struct A::Y; // expected-error {{cannot export redeclaration 'Y' here.}}
----------------
um, is that really invalid? it looks to me that one's reexporting an already exported namespace entity. It's perfectly valid to write::
namespace A{ export struct X;}
namespace A { export struct X;}
so I don't see why 'export struct A::X;' is invalid. (I realize this is not a change you;ve made).
also applies to foo.
================
Comment at: clang/test/CXX/module/module.interface/p6.cpp:48
+export struct A::X; // expected-error {{cannot export redeclaration 'X' here.}}
+export struct A::Y; // expected-error {{cannot export redeclaration 'Y' here.}}
+export void A::foo(); // expected-error {{cannot export redeclaration 'foo' here.}}
----------------
Can we note (a) as the original declaration was not exported, and note where it is?
'cannot export redeclaration %0 as it is not exported'
'note: declared here'
also applies to bar
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112903/new/
https://reviews.llvm.org/D112903
More information about the cfe-commits
mailing list