https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51851
Waffl3x <waffl3x at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |waffl3x at gcc dot gnu.org
--- Comment #9 from Waffl3x <waffl3x at gcc dot gnu.org> ---
I debated with myself whether this was worth raising or not, but on the
off chance that it hasn't been before I have a new example.
The following produces two specializations with the same mangled name,
but (by my interpretation of the spec) they do not correspond.
https://godbolt.org/z/PdbWzMv93
```
template<typename T>
void f(T a, decltype(a)& b) {}
template<typename T>
void f(T const a, decltype(a)& b) {}
template void f<int>(int, int&);
template void f<int>(int, int const&);
```
I'm not sure whether this is considered an ABI bug, but I can't find
wording in the standard that makes this ill-formed [no diagnostic
required]. I'm likely just misinterpreting the relevant sections about
corresponding declarations though.
Obviously this would almost certainly never be found in the wild, but
here is an example where a const object is mutated.
https://godbolt.org/z/4K1TWGnda
```
template<typename T>
void f(T a, decltype(a)& b)
{ b = a; }
template<typename T>
void f(T const a, decltype(a)& b);
template void f<int>(int, int&);
int main()
{
int const b = 0;
int const& a = b;
f(42, a);
return a;
}
```