re PR c++/79654 (ICE on invalid c++ code in register_dtor_fn in cp/decl.c:7877)
PR c++/79654 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node on error. * pt.c (tsubst_decomp_names): Return error_mark_node if the first decl after the decomposition artificial decl has error_mark_node. * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p instead of just == error_mark_node comparison. * g++.dg/cpp1z/decomp26.C: New test. Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com> From-SVN: r245639
This commit is contained in:
parent
5c3f1d7b10
commit
b7280ac270
|
@ -1,3 +1,14 @@
|
|||
2017-02-21 Jakub Jelinek <jakub@redhat.com>
|
||||
Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/79654
|
||||
* decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
|
||||
on error.
|
||||
* pt.c (tsubst_decomp_names): Return error_mark_node if the first
|
||||
decl after the decomposition artificial decl has error_mark_node.
|
||||
* decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
|
||||
instead of just == error_mark_node comparison.
|
||||
|
||||
2017-02-21 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR sanitizer/79589
|
||||
|
|
|
@ -7386,7 +7386,6 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
|
|||
}
|
||||
first = DECL_CHAIN (first);
|
||||
}
|
||||
TREE_TYPE (decl) = error_mark_node;
|
||||
if (DECL_P (decl) && DECL_NAMESPACE_SCOPE_P (decl))
|
||||
SET_DECL_ASSEMBLER_NAME (decl, get_identifier ("<decomp>"));
|
||||
return;
|
||||
|
|
|
@ -3879,7 +3879,7 @@ prune_vars_needing_no_initialization (tree *vars)
|
|||
tree init = TREE_PURPOSE (t);
|
||||
|
||||
/* Deal gracefully with error. */
|
||||
if (decl == error_mark_node)
|
||||
if (error_operand_p (decl))
|
||||
{
|
||||
var = &TREE_CHAIN (t);
|
||||
continue;
|
||||
|
|
|
@ -15610,6 +15610,11 @@ tsubst_decomp_names (tree decl, tree pattern_decl, tree args,
|
|||
&& DECL_NAME (decl2);
|
||||
decl2 = DECL_CHAIN (decl2))
|
||||
{
|
||||
if (TREE_TYPE (decl2) == error_mark_node && *cnt == 0)
|
||||
{
|
||||
gcc_assert (errorcount);
|
||||
return error_mark_node;
|
||||
}
|
||||
(*cnt)++;
|
||||
gcc_assert (DECL_HAS_VALUE_EXPR_P (decl2));
|
||||
tree v = DECL_VALUE_EXPR (decl2);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2017-02-21 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/79654
|
||||
* g++.dg/cpp1z/decomp26.C: New test.
|
||||
|
||||
PR sanitizer/79589
|
||||
* g++.dg/ubsan/pr79589.C: New test.
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// PR c++/79654
|
||||
// { dg-do compile { target c++11 } }
|
||||
// { dg-options "" }
|
||||
|
||||
template<typename T> T &make(); // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .+1 }
|
||||
auto [d1, d2] = make<int>(); // { dg-error "cannot decompose non-array non-class type" }
|
Loading…
Reference in New Issue