2011-03-17 Jason Merrill <jason@redhat.com>
+ PR c++/47504
+ * semantics.c (cxx_eval_constant_expression) [NOP_EXPR]: Don't let
+ the conversion set TREE_OVERFLOW.
+
Core 1212
* semantics.c (finish_decltype_type): Return T&& for xvalue.
* typeck.c (unlowered_expr_type): Preserve cv-quals.
conversion. */
return fold (t);
r = fold_build1 (TREE_CODE (t), to, op);
+ /* Conversion of an out-of-range value has implementation-defined
+ behavior; the language considers it different from arithmetic
+ overflow, which is undefined. */
+ if (TREE_OVERFLOW_P (r) && !TREE_OVERFLOW_P (op))
+ TREE_OVERFLOW (r) = false;
}
break;
+2011-03-17 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/constexpr-overflow2.C: New.
+ * g++.dg/cpp0x/constexpr-data2.C: Remove FIXME.
+
2011-03-17 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/elab2.ads: New test.
// Use.
A3<int, 1111> a31;
-// FIXME should this be an error?
A3<char, 9999> a32; // { dg-warning "overflow" }
--- /dev/null
+// PR c++/47504
+// { dg-options -std=c++0x }
+
+char constexpr sub(char arg)
+{ return char(arg - char(1)); }
+
+int main()
+{ static char constexpr m = sub(-1); }