Hi!

The recent concept changes that were also backported to 6.2 break
diagnostics e.g. on the following testcase, sometimes it ICEs during
reporting of the first error, so isn't just a normal low prio error
recovery.  The thing is that on the testcase the VAR_DECL has no
DECL_LANG_SPECIFIC, DECL_DECLARED_CONSTEXPR_P is a lang flag rather than
lang_specific field.  I believe in various places in cp/error.c we check
for *_LANG_SPECIFIC similarly.  In addition, the hunk had formatting issues.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk/6.3?

2016-09-05  Jakub Jelinek  <ja...@redhat.com>

        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.

--- gcc/cp/error.c.jj   2016-09-02 18:17:32.000000000 +0200
+++ gcc/cp/error.c      2016-09-05 14:01:43.091770870 +0200
@@ -959,14 +959,13 @@ dump_simple_decl (cxx_pretty_printer *pp
 {
   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);
     }
--- gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C.jj     2016-09-05 
13:58:59.609821176 +0200
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C        2016-09-05 
13:58:18.000000000 +0200
@@ -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" }

        Jakub

Reply via email to