+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
}
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;
tree init = TREE_PURPOSE (t);
/* Deal gracefully with error. */
- if (decl == error_mark_node)
+ if (error_operand_p (decl))
{
var = &TREE_CHAIN (t);
continue;
&& 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);
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.
--- /dev/null
+// 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" }