[Bug c++/92402] parsing error in lambda trail return type with decltype, statement expressions and structured bindings
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92402 --- Comment #4 from Marek Polacek --- Not a regression though, so I'll leave it for GCC 11.
[Bug c++/92402] parsing error in lambda trail return type with decltype, statement expressions and structured bindings
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92402 --- Comment #3 from Marek Polacek --- Even shorter: int a[1]; void f() { []() -> decltype(({auto&& [x] = a; 0;})) { return 0; }; } clang++ compiles it.
[Bug c++/92402] parsing error in lambda trail return type with decltype, statement expressions and structured bindings
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92402 Martin Liška changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2020-01-30 CC||jason at gcc dot gnu.org, ||marxin at gcc dot gnu.org, ||mpolacek at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from Martin Liška --- Confirmed.
[Bug c++/92402] parsing error in lambda trail return type with decltype, statement expressions and structured bindings
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92402 Will Wray changed: What|Removed |Added CC||wjwray at gmail dot com --- Comment #1 from Will Wray --- 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