+2014-03-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/60254
+ * semantics.c (finish_static_assert): Call cxx_constant_value only
+ if require_potential_rvalue_constant_expression returns true.
+
2014-03-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60389
else if (condition && condition != error_mark_node)
{
error ("non-constant condition for static assertion");
- cxx_constant_value (condition);
+ if (require_potential_rvalue_constant_expression (condition))
+ cxx_constant_value (condition);
}
input_location = saved_loc;
}
+2014-03-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/60254
+ * g++.dg/cpp0x/static_assert10.C: New.
+ * g++.dg/cpp0x/static_assert11.C: Likewise.
+ * g++.dg/cpp0x/static_assert3.C: Adjust.
+
2014-03-13 Richard Biener <rguenther@suse.de>
* lib/lto.exp (lto-execute): Fix error catching for dg-final.
--- /dev/null
+// PR c++/60254
+// { dg-do compile { target c++11 } }
+
+template<typename T> bool foo(T)
+{
+ int i;
+ static_assert(foo(i), "Error"); // { dg-error "non-constant condition|not usable" }
+}
--- /dev/null
+// PR c++/60254
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ template<typename T> bool foo(T)
+ {
+ static_assert(foo(0), "Error"); // { dg-error "non-constant condition|constant expression" }
+ }
+};
// { dg-do compile { target c++11 } }
static_assert(7 / 0, "X"); // { dg-error "non-constant condition" "non-constant" }
// { dg-warning "division by zero" "zero" { target *-*-* } 2 }
-// { dg-error "7 / 0.. is not a constant expression" "not a constant" { target *-*-* } 2 }
+// { dg-error "division by zero is not a constant-expression" "not a constant" { target *-*-* } 2 }