aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/expr/expr.const/p2-0x.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-01-30 22:27:01 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-01-30 22:27:01 +0000
commitf72fccf533bca206af8e75d041c29db99e6a7f2c (patch)
tree024c4044375c5ed02ffc50aad332ce8fb680da2f /test/CXX/expr/expr.const/p2-0x.cpp
parentacd8c513b9db3a166b5409cd8e75712a7157b7b6 (diff)
constexpr: disallow signed integer overflow in integral conversions in constant
expressions in C++11. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149286 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.const/p2-0x.cpp')
-rw-r--r--test/CXX/expr/expr.const/p2-0x.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/CXX/expr/expr.const/p2-0x.cpp b/test/CXX/expr/expr.const/p2-0x.cpp
index 2570c60512..4b425da73c 100644
--- a/test/CXX/expr/expr.const/p2-0x.cpp
+++ b/test/CXX/expr/expr.const/p2-0x.cpp
@@ -118,6 +118,9 @@ namespace UndefinedBehavior {
void f(int n) {
switch (n) {
case (int)4.4e9: // expected-error {{constant expression}} expected-note {{value 4.4E+9 is outside the range of representable values of type 'int'}}
+ case (int)10000000000ll: // expected-error {{constant expression}} expected-note {{value 10000000000 is outside the range of representable values of type 'int'}} expected-note {{here}}
+ case (int)0x80000000u: // expected-error {{constant expression}} expected-note {{value 2147483648 is outside the range of representable values of type 'int'}}
+ case (unsigned int)10000000000ll: // expected-error {{duplicate case value}}
case (int)(unsigned)(long long)4.4e9: // ok
case (int)(float)1e300: // expected-error {{constant expression}} expected-note {{value 1.0E+300 is outside the range of representable values of type 'float'}}
case (int)((float)1e37 / 1e30): // ok