Endilll wrote:

> Unfortunately it seems the triple is needed on Windows.

I looked into this. The failing tests came from #93873. I came up with the 
following reduction of the CWG727 test:
```cpp
template<int> struct B {
  template<int> static const int u = 1;
  template<> const int u<0> = 2; // #cwg727-u0         // rejected by GCC
};

template<> template<int> constexpr int B<0>::u    = 3; // rejected by GCC
template<> template<>    constexpr int B<0>::u<0> = 4; // rejected by Clang, 
accepted by MSVC, EDG, and Clang with x86_64-pc-windows-msvc triple
// since-cxx14-error@-1 {{static data member 'u' already has an initializer}}
//   since-cxx14-note@#cwg727-u0 {{previous initialization is here}}

static_assert(B<0>().u<0> == 2, ""); // passes in Clang and in Clang with 
x86_64-pc-windows-msvc triple
static_assert(B<0>().u<0> == 4, ""); // passes in GCC, EDG, and MSVC
```
(I can't replicate the behavior of Clang with MSVC triple on Compiler Explorer, 
but I'm seeing this locally on my Linux machine.)

So it appears that itanium ABI triple disables MSVC compatibility mode, making 
this test work on all targets.

I believe Clang behavior is incorrect, and I'll file a dedicated issue for 
that, because it's a rabbit's hole. Separately, this issue with 
`arm64-apple-darwin-unknown` showcases that itanium ABI triple does more that 
just disabling MSVC compatibility mode. Are there other ways to disable 
compatibility mode without negative side effects? Apparently, 
`-fno-ms-compatibility` is not a thing. 



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

Reply via email to