dmpolukhin wrote:

Thanks for working on this! I compared the patch against GCC trunk and 16.2 
(they agree). GCC keeps a single namespace entity, every reopening **adds** its 
tags to it (a union), and it never diagnoses. So only tags that a reopening 
*adds* relative to the first declaration are actually dropped by Clang. I think 
it is better to implement GCC behavior instead of add diagnostic that GCC 
doesn't emit and has well defined and different behavior.
```
namespace std { inline namespace __cxx11 __attribute__((__abi_tag__("cxx11"))) 
{} }
namespace std { namespace __cxx11 { template<class C> struct basic_string {}; }
                typedef basic_string<char> string; }
std::string f() { return {}; }   // GCC, clang trunk, this PR: _Z1fB5cxx11v
// PR: error: absent 'abi_tag' attribute is ignored, applying 'abi_tag' cxx11
--
inline namespace N __attribute__((abi_tag("A", "B"))) { struct S {}; }
inline namespace N __attribute__((abi_tag("A"))) {}
S f();   // GCC and Clang: _Z1fB1AB1Bv
// PR: error: 'abi_tag' A is ignored, applying 'abi_tag' A, B   <- A *is* 
applied
```

https://github.com/llvm/llvm-project/pull/221039
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to