https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92402
Will Wray <wjwray at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |wjwray at gmail dot com
--- Comment #1 from Will Wray <wjwray at gmail dot com> ---
Here's a motivating use case; https://godbolt.org/z/Tt-QmN
This allows to effectively SFINAE on structured binding - a 'missing link'.
Works in Clang since 5.0.
GDB debugging gcc latest trunk build. The parse error occurs here
gcc/cp/parser.c:13869
cp_parser_decomposition_declaration
else if (decl != error_mark_node && DECL_CHAIN (decl2) != prev)
{
/* Ensure we've diagnosed redeclaration if we aren't creating
a new VAR_DECL. */
gcc_assert (errorcount); /*** HERE ***/
decl = error_mark_node;
}
Haven't worked out exactly what is being checked there.
So I tried commenting out that entire else-if block to see what happens.
It then proceeds to mangling and crashes out in contains_struct_check.
Backtrace looks like this:
#0 contains_struct_check gcc/cp/mangle.c "write_closure_type_name"
gcc/tree.h:3386
#1 write_closure_type_name gcc/cp/mangle.c:1641 in write_unqualified_name
#3 write_prefix gcc/cp/mangle.c:1164 in mangle_decomp at gcc/cp/mangle.c:4050
#5 cp_maybe_mangle_decomp gcc/cp/decl.c:8024
#6 cp_parser_decomposition_declaration