summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-12-09 22:58:01 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-12-09 22:58:01 +0000
commitf57d8cb13121b1ecc171a7dc4393ed4cbebb835b (patch)
tree10134e5be0bb4b635552ded4670615102ee77a1b /clang/test
parent4517fe5020b842d8e82d35775d1925596ae1f588 (diff)
downloadbcm5719-llvm-f57d8cb13121b1ecc171a7dc4393ed4cbebb835b.tar.gz
bcm5719-llvm-f57d8cb13121b1ecc171a7dc4393ed4cbebb835b.zip
C++11 constant expressions: Don't use CheckICE in C++11; instead, determine
whether an expression is a (core) constant expression as a side-effect of evaluation. This takes us from accepting far too few expressions as ICEs to accepting slightly too many -- fixes for the remaining cases are coming next. The diagnostics produced when an expression is found to be non-constant are currently quite poor (with generic wording but reasonable source locations), and will be improved in subsequent commits. llvm-svn: 146289
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/i-c-e.c2
-rw-r--r--clang/test/Sema/switch.c4
-rw-r--r--clang/test/SemaCXX/constant-expression-cxx11.cpp8
3 files changed, 4 insertions, 10 deletions
diff --git a/clang/test/Sema/i-c-e.c b/clang/test/Sema/i-c-e.c
index cb9dcabafce..210a811dc5d 100644
--- a/clang/test/Sema/i-c-e.c
+++ b/clang/test/Sema/i-c-e.c
@@ -21,7 +21,7 @@ char b[__builtin_constant_p((int)(1.0+2.0)) ? (int)(1.0+2.0) : -1];
struct c {
int a : ( // expected-error {{expression is not an integer constant expression}}
__builtin_constant_p((int)(1.0+2.0)) ? (int)(1.0+
- expr // expected-note {{subexpression not valid in an integer constant expression}}
+ expr // expected-note {{subexpression not valid in a constant expression}}
) : -1);
};
diff --git a/clang/test/Sema/switch.c b/clang/test/Sema/switch.c
index 96a6eb6e963..ef2e4c5d9b7 100644
--- a/clang/test/Sema/switch.c
+++ b/clang/test/Sema/switch.c
@@ -50,12 +50,12 @@ void test4()
}
switch (cond) {
- case g() && 0: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}}
+ case g() && 0: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in a constant expression}}
break;
}
switch (cond) {
- case 0 ... g() || 1: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}}
+ case 0 ... g() || 1: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in a constant expression}}
break;
}
}
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp
index 9ff50d30ddd..0fc23285b33 100644
--- a/clang/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp
@@ -1,12 +1,6 @@
// RUN: %clang_cc1 -triple i686-linux -fsyntax-only -verify -std=c++11 %s
-// This version of static_assert just requires a foldable value as the
-// expression, not an ICE.
-// FIXME: Once we implement the C++11 ICE rules, most uses of this here should
-// be converted to static_assert.
-#define static_assert_fold(expr, str) \
- static_assert(__builtin_constant_p(expr), "not an integral constant expression"); \
- static_assert(__builtin_constant_p(expr) ? expr : true, str)
+#define static_assert_fold static_assert
namespace StaticAssertFoldTest {
OpenPOWER on IntegriCloud