aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-02-06 21:03:15 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2017-02-06 21:03:15 +0100
commita5e8cbd150d7e7200d54e2e1e125161139e2c7b8 (patch)
tree77dc53b736e0bcccd7d0f3a5540ae17b6d0b4996 /gcc/cp
parent6f26f15f136506e40bb7a3a4f1cd5ca171322928 (diff)
downloadgcc-a5e8cbd150d7e7200d54e2e1e125161139e2c7b8.zip
gcc-a5e8cbd150d7e7200d54e2e1e125161139e2c7b8.tar.gz
gcc-a5e8cbd150d7e7200d54e2e1e125161139e2c7b8.tar.bz2
re PR c++/79372 (ICE on C++ code with illegal decomposition declaration on x86_64-linux-gnu: in tsubst_decomp_names, at cp/pt.c:15599)
PR c++/79372 * decl.c (cp_finish_decomp): On error set decl type to error_mark_node. * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions with error_mark_node type. * g++.dg/cpp1z/decomp25.C: New test. From-SVN: r245218
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c1
-rw-r--r--gcc/cp/pt.c4
3 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d032028..9889c17 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2017-02-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/79372
+ * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
+ * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
+ with error_mark_node type.
+
2017-02-03 Jason Merrill <jason@redhat.com>
PR c++/78689 - ICE on constructor with label
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9bdfd4f..d1d485a 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7378,6 +7378,7 @@ 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;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 4c4941a..6072432 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -15765,7 +15765,9 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
const_init = (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P
(pattern_decl));
cp_finish_decl (decl, init, const_init, NULL_TREE, 0);
- if (VAR_P (decl) && DECL_DECOMPOSITION_P (decl))
+ if (VAR_P (decl)
+ && DECL_DECOMPOSITION_P (decl)
+ && TREE_TYPE (pattern_decl) != error_mark_node)
{
unsigned int cnt;
tree first;