https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121655
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[13/14/15/16 Regression] |[13/14/15/16 Regression]
|struct binding as template |struct binding as template
|argument vs |argument vs
|reinterpret_cast |reinterpret_cast since
| |r8-4678
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For
template<char &E> void f();
struct test_t { char a; } t;
test_t& dummy_object = t;
auto& [v0] = dummy_object;
void g()
{
f<v0>();
}
g++ disagrees with clang++ on how to mangle it.
GCC mangles it as
_Z1fIXdtL_Z1tE1aEEvv
demangled as
void f<t.a>()
while clang as
_Z1fIXsocL_Z1tEEEEvv
which binutils demangler doesn't demangle but llvm-cxxfilt demangles as
void f<t.<char at offset 0> >()
For #c1, clang rejects it:
<source>:8:3: error: no matching function for call to 'f'
8 | f<v0>();
| ^~~~~
<source>:1:24: note: candidate template ignored: invalid explicitly-specified
argument for template parameter 'E'
1 | template<char &E> void f();
| ^
while GCC ICEs, apparently because mangle_decl gives up on it:
4562 /* Don't bother mangling uninstantiated templates. */
4563 ++processing_template_decl;
4564 if (TREE_CODE (decl) == TYPE_DECL)
4565 dep = dependent_type_p (TREE_TYPE (decl));
4566 else
4567 dep = (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)
4568 && any_dependent_template_arguments_p (DECL_TI_ARGS
(decl)));
4569 --processing_template_decl;
4570 if (dep)
4571 return;
but caller expects mangle_decl to set DECL_ASSEMBLER_NAME.
The ICE started with r8-4678-g6296cf8e099aae43c86a773f93d83a19df85d7e7