From: Jakub Jelinek Date: Fri, 16 Sep 2016 20:25:17 +0000 (+0200) Subject: re PR c++/77482 (Segfault when compiling ill-formed constexpr code) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f03e02f36105e7b3c7d21ce2368f3e3147d091a;p=gcc.git re PR c++/77482 (Segfault when compiling ill-formed constexpr code) PR c++/77482 * error.c (dump_simple_decl): Only check DECL_DECLARED_CONCEPT_P if DECL_LANG_SPECIFIC is non-NULL. Fix up formatting. * g++.dg/cpp0x/constexpr-77482.C: New test. From-SVN: r240198 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0c7d35140bf..9d74bdbb8ba 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2016-09-16 Jakub Jelinek + PR c++/77482 + * error.c (dump_simple_decl): Only check DECL_DECLARED_CONCEPT_P + if DECL_LANG_SPECIFIC is non-NULL. Fix up formatting. + PR c++/77338 * constexpr.c (cxx_eval_constant_expression) : Only call is_really_empty_class on complete types. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 88049ee8f1a..ca7360fa602 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -959,14 +959,13 @@ dump_simple_decl (cxx_pretty_printer *pp, tree t, tree type, int flags) { if (flags & TFF_DECL_SPECIFIERS) { - if (VAR_P (t) - && DECL_DECLARED_CONSTEXPR_P (t)) - { - if (DECL_DECLARED_CONCEPT_P (t)) - pp_cxx_ws_string (pp, "concept"); - else - pp_cxx_ws_string (pp, "constexpr"); - } + if (VAR_P (t) && DECL_DECLARED_CONSTEXPR_P (t)) + { + if (DECL_LANG_SPECIFIC (t) && DECL_DECLARED_CONCEPT_P (t)) + pp_cxx_ws_string (pp, "concept"); + else + pp_cxx_ws_string (pp, "constexpr"); + } dump_type_prefix (pp, type, flags & ~TFF_UNQUALIFIED_NAME); pp_maybe_space (pp); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 88d32962d9f..dfcccf7726e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-09-16 Jakub Jelinek + PR c++/77482 + * g++.dg/cpp0x/constexpr-77482.C: New test. + PR c++/77379 * g++.dg/abi/abi-tag23.C: Adjust scan-assembler regex for differing thunk offsets. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C new file mode 100644 index 00000000000..6f5c91621ce --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C @@ -0,0 +1,6 @@ +// PR c++/77482 +// { dg-do compile { target c++11 } } + +constexpr auto x; // { dg-error "declaration\[^\n\r]*has no initializer" } +extern struct S s; +constexpr auto y = s; // { dg-error "has incomplete type" }