https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86836
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I've tried to defer the assert until after cp_finish_decl: --- pt.c.jj1 2018-07-31 23:57:23.000000000 +0200 +++ pt.c 2018-08-03 11:11:41.384454435 +0200 @@ -16555,10 +16555,7 @@ tsubst_decomp_names (tree decl, tree pat decl2 = DECL_CHAIN (decl2)) { if (TREE_TYPE (decl2) == error_mark_node && *cnt == 0) - { - gcc_assert (errorcount); - return error_mark_node; - } + return error_mark_node; (*cnt)++; gcc_assert (DECL_DECOMP_BASE (decl2) == pattern_decl); gcc_assert (DECL_HAS_VALUE_EXPR_P (decl2)); @@ -16572,7 +16569,6 @@ tsubst_decomp_names (tree decl, tree pat DECL_TEMPLATE_INSTANTIATED (decl3) = 1; else { - gcc_assert (errorcount); decl = error_mark_node; continue; } @@ -16582,10 +16578,7 @@ tsubst_decomp_names (tree decl, tree pat else if (decl != error_mark_node && DECL_CHAIN (decl3) != prev && decl != prev) - { - gcc_assert (errorcount); - decl = error_mark_node; - } + decl = error_mark_node; else prev = decl3; } @@ -16770,6 +16763,8 @@ tsubst_expr (tree t, tree args, tsubst_f cp_finish_decl (decl, init, const_init, NULL_TREE, 0); if (ndecl != error_mark_node) cp_finish_decomp (ndecl, first, cnt); + else + gcc_assert (errorcount); } else cp_finish_decl (decl, init, const_init, NULL_TREE, 0); @@ -16813,9 +16808,13 @@ tsubst_expr (tree t, tree args, tsubst_f tree decomp_first = NULL_TREE; unsigned decomp_cnt = 0; if (VAR_P (decl) && DECL_DECOMPOSITION_P (decl)) - decl = tsubst_decomp_names (decl, RANGE_FOR_DECL (t), args, - complain, in_decl, - &decomp_first, &decomp_cnt); + { + decl = tsubst_decomp_names (decl, RANGE_FOR_DECL (t), args, + complain, in_decl, + &decomp_first, &decomp_cnt); + if (decl == error_mark_node) + gcc_assert (errorcount); + } if (processing_template_decl) { but that doesn't help, the bug isn't diagnosed in this case either. For some reason, the orig decomp VAR_DECL is tsubsted to the PARM_DECL rather than a new VAR_DECL representing the structured binding id, and thus also cp_finish_decl succeeds. Giving up here.