From: Marek Polacek Date: Fri, 1 Mar 2019 15:55:56 +0000 (+0000) Subject: PR c++/89532 - ICE with incomplete type in decltype. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d724d2aff687414567caad50eda806a28480c771;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 11b9bb2dd9b..ae5fd563dc3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-03-01 Marek Polacek + + 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 Implement P1002R1, Try-catch blocks in constexpr functions diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index d1a378acd98..c03e4ef247c 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 7734ac679a5..88cda1a9df2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-01 Marek Polacek + + PR c++/89532 - ICE with incomplete type in decltype. + * g++.dg/cpp2a/nontype-class14.C: New test. + 2019-03-01 Jakub Jelinek 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 00000000000..9cc14460734 --- /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 // { dg-error "invalid use of incomplete type" } +struct S { }; + +template +decltype(tuple {}) d; // { dg-error "invalid use of incomplete type" }