summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/complex-init-list.c4
-rw-r--r--clang/test/PCH/floating-literal.c4
-rw-r--r--clang/test/Sema/const-eval.c2
-rw-r--r--clang/test/Sema/integer-overflow.c1
-rw-r--r--clang/test/Sema/switch-1.c3
-rw-r--r--clang/test/SemaCXX/enum.cpp17
6 files changed, 21 insertions, 10 deletions
diff --git a/clang/test/CodeGen/complex-init-list.c b/clang/test/CodeGen/complex-init-list.c
index fa266b26bb9..bc38e2caf21 100644
--- a/clang/test/CodeGen/complex-init-list.c
+++ b/clang/test/CodeGen/complex-init-list.c
@@ -4,8 +4,8 @@
// of a complex number individually using an initialization list. (There is a
// extensive description and test in test/Sema/complex-init-list.c.)
-_Complex float x = { 1.0f, -1.0f };
-// CHECK: @x = global { float, float } { float 1.000000e+00, float -1.000000e+00 }, align 4
+_Complex float x = { 1.0f, 1.0f/0.0f };
+// CHECK: @x = global { float, float } { float 1.000000e+00, float 0x7FF0000000000000 }, align 4
_Complex float f(float x, float y) { _Complex float z = { x, y }; return z; }
// CHECK-LABEL: define <2 x float> @f
diff --git a/clang/test/PCH/floating-literal.c b/clang/test/PCH/floating-literal.c
index 9037deaf4e9..b5ff6fe84b8 100644
--- a/clang/test/PCH/floating-literal.c
+++ b/clang/test/PCH/floating-literal.c
@@ -15,5 +15,5 @@ long double foo = 1.0E4000L;
double bar = 1.0E300;
// CHECK: double bar = 1.0000000000000001E+300;
-float wibble = 2.0E38;
-// CHECK: float wibble = 2.0E+38;
+float wibble = 1.0E40;
+// CHECK: float wibble = 1.0E+40;
diff --git a/clang/test/Sema/const-eval.c b/clang/test/Sema/const-eval.c
index 7c2cd0efd5e..bfb58bc573e 100644
--- a/clang/test/Sema/const-eval.c
+++ b/clang/test/Sema/const-eval.c
@@ -129,7 +129,7 @@ extern struct Test50S Test50;
EVAL_EXPR(50, &Test50 < (struct Test50S*)((unsigned)&Test50 + 10)) // expected-error {{must have a constant size}}
// <rdar://problem/11874571>
-EVAL_EXPR(51, 0 != (float)1e38)
+EVAL_EXPR(51, 0 != (float)1e99)
// PR21945
void PR21945() { int i = (({}), 0l); }
diff --git a/clang/test/Sema/integer-overflow.c b/clang/test/Sema/integer-overflow.c
index 8f74873ed94..44fbcd4c818 100644
--- a/clang/test/Sema/integer-overflow.c
+++ b/clang/test/Sema/integer-overflow.c
@@ -7,7 +7,6 @@ uint64_t f1(uint64_t, uint32_t);
uint64_t f2(uint64_t, ...);
static const uint64_t overflow = 1 * 4608 * 1024 * 1024; // expected-warning {{overflow in expression; result is 536870912 with type 'int'}}
-// expected-error@-1 {{not a compile-time constant}}
uint64_t check_integer_overflows(int i) {
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
diff --git a/clang/test/Sema/switch-1.c b/clang/test/Sema/switch-1.c
index 0d31a191c4f..144c3607f57 100644
--- a/clang/test/Sema/switch-1.c
+++ b/clang/test/Sema/switch-1.c
@@ -55,8 +55,5 @@ int f(int i) {
// rdar://18405357
unsigned long long l = 65536 * 65536; // expected-warning {{overflow in expression; result is 0 with type 'int'}}
-#ifndef __cplusplus
-// expected-error@-2 {{not a compile-time constant}}
-#endif
unsigned long long l2 = 65536 * (unsigned)65536;
unsigned long long l3 = 65536 * 65536ULL;
diff --git a/clang/test/SemaCXX/enum.cpp b/clang/test/SemaCXX/enum.cpp
index 370e1c34d29..6b0824b7514 100644
--- a/clang/test/SemaCXX/enum.cpp
+++ b/clang/test/SemaCXX/enum.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++98 -verify -triple x86_64-apple-darwin %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++11 -verify -triple x86_64-apple-darwin %s
enum E { // expected-note{{previous definition is here}}
Val1,
Val2
@@ -88,10 +89,24 @@ typedef enum { }; // expected-warning{{typedef requires a name}}
// PR7921
enum PR7921E {
- PR7921V = (PR7921E)(123) // expected-error {{expression is not an integral constant expression}}
+ PR7921V = (PR7921E)(123)
+#if __cplusplus < 201103L
+// expected-error@-2 {{expression is not an integral constant expression}}
+#else
+// expected-error@-4 {{must have integral or unscoped enumeration type}}
+// FIXME: The above diagnostic isn't very good; we should instead complain about the type being incomplete.
+#endif
};
void PR8089() {
enum E; // expected-error{{ISO C++ forbids forward references to 'enum' types}}
int a = (E)3; // expected-error{{cannot initialize a variable of type 'int' with an rvalue of type 'E'}}
}
+
+// This is accepted as a GNU extension. In C++98, there was no provision for
+// expressions with UB to be non-constant.
+enum { overflow = 123456 * 234567 };
+#if __cplusplus >= 201103L
+// expected-warning@-2 {{not an integral constant expression}}
+// expected-note@-3 {{value 28958703552 is outside the range of representable values}}
+#endif
OpenPOWER on IntegriCloud