aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2019-03-01 15:55:56 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2019-03-01 15:55:56 +0000
commitd724d2aff687414567caad50eda806a28480c771 (patch)
tree0f3979606f9d8f7af1c9e4be853d58ed0719f489 /gcc
parent337f1caed6378294b8fe97347dbb0a5e6651a71b (diff)
downloadgcc-d724d2aff687414567caad50eda806a28480c771.zip
gcc-d724d2aff687414567caad50eda806a28480c771.tar.gz
gcc-d724d2aff687414567caad50eda806a28480c771.tar.bz2
PR c++/89532 - ICE with incomplete type in decltype.
* semantics.c (finish_compound_literal): Return error_mark_node if digest_init_flags returns error_mark_node. * g++.dg/cpp2a/nontype-class14.C: New test. From-SVN: r269317
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nontype-class14.C10
4 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 11b9bb2..ae5fd56 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2019-03-01 Marek Polacek <polacek@redhat.com>
+
+ PR c++/89532 - ICE with incomplete type in decltype.
+ * semantics.c (finish_compound_literal): Return error_mark_node
+ if digest_init_flags returns error_mark_node.
+
2019-03-01 Jakub Jelinek <jakub@redhat.com>
Implement P1002R1, Try-catch blocks in constexpr functions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index d1a378a..c03e4ef 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2859,6 +2859,9 @@ finish_compound_literal (tree type, tree compound_literal,
compound_literal = digest_init_flags (type, compound_literal,
LOOKUP_NORMAL | LOOKUP_NO_NARROWING,
complain);
+ if (compound_literal == error_mark_node)
+ return error_mark_node;
+
/* If we're in a template, return the original compound literal. */
if (orig_cl)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7734ac6..88cda1a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-01 Marek Polacek <polacek@redhat.com>
+
+ PR c++/89532 - ICE with incomplete type in decltype.
+ * g++.dg/cpp2a/nontype-class14.C: New test.
+
2019-03-01 Jakub Jelinek <jakub@redhat.com>
Implement P1002R1, Try-catch blocks in constexpr functions
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class14.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class14.C
new file mode 100644
index 0000000..9cc1446
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class14.C
@@ -0,0 +1,10 @@
+// PR c++/89532
+// { dg-do compile { target c++2a } }
+
+struct tuple;
+
+template <decltype(tuple {})> // { dg-error "invalid use of incomplete type" }
+struct S { };
+
+template<typename>
+decltype(tuple {}) d; // { dg-error "invalid use of incomplete type" }