[Bug c++/98485] Symbols for identical constrained specializations have different linkage

admin at maniacsvault dot net gcc-bugzilla@gcc.gnu.org
Thu Dec 31 10:15:05 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98485

--- Comment #2 from Braden Obrzut <admin at maniacsvault dot net> ---
I'm actually not certain if I'm playing fast and loose with ODR.  While I can
definitely agree that this construct is fragile, if a specialization has the
same sequence of tokens as the base template is it actually considered a
different definition?  Thinking of C++20 6.3 paragraph 13.8 here.

While same sequence of tokens isn't strictly true in the provided example, one
could easily hoist the definitions of f1 out of the structure definition to
make each specialization exactly the same as the base template and GCC still
wants to use internal linkage for the second specialization.

Not that it technically would matter if it's indeed an ODR violation, but Clang
does seem to work as expected for this scenario.


More information about the Gcc-bugs mailing list