https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118849
Bug ID: 118849
Summary: Template specialisations referencing internal-linkage
CNTTPs are not unique
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Keywords: ABI, wrong-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nshead at gcc dot gnu.org
Target Milestone: ---
On GCC14 and trunk, a class non-type template parameter with internal linkage
does not constrain the linkage of templates referring to it:
namespace {
struct A {};
}
template <auto Q> void foo() {}
void bar() {
foo<A{}>();
}
Here 'foo' is externally visible, which can cause issues.
GCC13 handled this correctly. I suspect this was caused by r14-9596.