https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107521
Bug ID: 107521
Summary: clang rejects invalid code in libstdc++
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tim at klingt dot org
Target Milestone: ---
compare https://github.com/llvm/llvm-project/issues/58754
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/char_traits.h#L216-L217
```
if (__s1 == __s2) // unlikely, but saves a lot of work
return __s1;
```
according to aaron ballman:
> Heh, that's a fun one. http://eel.is/c++draft/lex.string#9 is what that code
> is referring to and I believe Clang is correct to reject it as a core
> constant expression per http://eel.is/c++draft/expr.const#5.24 because the
> equality operator's results are unspecified.
according to jonathan wakely:
> This is a libstdc++ bug.
> And a g++ bug, for letting me do it.