https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127259
Bug ID: 127259
Summary: Mangling collision for reference NTTPs bound to
different subobjects of the same tuple
Product: gcc
Version: 13.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: svalorzen at gmail dot com
Target Milestone: ---
See the code: https://godbolt.org/z/PeoGzK4c9
I've originally got this in 13.3, but on godbolt the code fails on every GCC
version I've tried.
```
#include <tuple>
#include <cstdio>
struct E { int i; };
static constexpr std::tuple<E, E> s{E{1}, E{2}};
template <const auto& Elem>
struct V { static constexpr int tag = Elem.i; };
template <std::size_t I>
using Pick = V<std::get<I>(s)>;
int main() {
// Compiles, but linker complains about multiple definitions because
// Pick<0>::tag and Pick<1>::tag are mangled identically.
std::printf("%p %p\n", (const void*) &Pick<0>::tag, (const void*)
&Pick<1>::tag);
}
```