@@ -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);
new file mode 100644
@@ -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" }
+};