dmpolukhin wrote:
Consider the standard libstdc++ idiom: c++config.h tags __cxx11 once, and
`_GLIBCXX_BEGIN_NAMESPACE_CXX11` expands to a bare `namespace __cxx11 {`.
Because of this, I strongly believe there should be no diagnostic when
reopening a namespace without an abi_tag. The tag union behavior is crucial if
a forward declaration without an abi_tag appears before the header that adds
it. I agree the later cases are often not intentional, but since the tag-adding
declaration is typically in a system header, a diagnostic alone would usually
be suppressed and unhelpful. Moreover, mangling like the old ABI variant will
result in a runtime crash in many cases.
Given this, I think the best approach is to do both: keep the GCC-compatible
union behavior (which turns a runtime crash into working code) and add a
warning specifically when a reopening adds a tag that the first declaration
lacks.
https://github.com/llvm/llvm-project/pull/224826
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits