]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/48212 ([C++0x] ICE: in non_const_var_error, at cp/semantics.c:6700 on inval...
authorJason Merrill <jason@redhat.com>
Wed, 30 Mar 2011 20:29:13 +0000 (16:29 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 30 Mar 2011 20:29:13 +0000 (16:29 -0400)
PR c++/48212
* semantics.c (non_const_var_error): Just return if DECL_INITIAL
is error_mark_node.

From-SVN: r171748

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C [new file with mode: 0644]

index 8975e6cbf260d691bf4d4bbf32d4636225e7a305..584421536c0b51f85c4e0bb685636178ae8e0bf9 100644 (file)
@@ -1,3 +1,9 @@
+2011-03-30  Jason Merrill  <jason@redhat.com>
+
+       PR c++/48212
+       * semantics.c (non_const_var_error): Just return if DECL_INITIAL
+       is error_mark_node.
+
 2011-03-30  Jason Merrill  <jason@redhat.com>
 
        PR c++/48369
index 3300c3f5b3a0aa9714427653eaf4baf7692158b7..e444d91267f7fc359c23afd9e817720df9b2eb1c 100644 (file)
@@ -6753,6 +6753,9 @@ non_const_var_error (tree r)
   tree type = TREE_TYPE (r);
   error ("the value of %qD is not usable in a constant "
         "expression", r);
+  /* Avoid error cascade.  */
+  if (DECL_INITIAL (r) == error_mark_node)
+    return;
   if (DECL_DECLARED_CONSTEXPR_P (r))
     inform (DECL_SOURCE_LOCATION (r),
            "%qD used in its own initializer", r);
index 301b5da03a85c2588f54125645207eacb095e073..f36c147e0bd06546dc28c4f2f27b3254d2615b59 100644 (file)
@@ -1,5 +1,7 @@
 2011-03-30  Jason Merrill  <jason@redhat.com>
 
+       * g++.dg/cpp0x/regress/error-recovery1.C: New.
+
        * g++.dg/cpp0x/regress/isnan.C: New.
 
        * g++.dg/cpp0x/initlist46.C: New.
diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C b/gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C
new file mode 100644 (file)
index 0000000..2094d3e
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/48212
+// { dg-options -std=c++0x }
+
+template < bool > void
+foo ()
+{
+  const bool b =;              // { dg-error "" }
+  foo < b > ();                        // { dg-error "constant expression" }
+};
This page took 0.089027 seconds and 5 git commands to generate.