summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/static-assert.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-03-14 00:25:26 +0000
committerAnders Carlsson <andersca@mac.com>2009-03-14 00:25:26 +0000
commit5bbe1d7ba74ed004b5f297185bf8f08e313b0c58 (patch)
tree93511ab04b94614acb6d436a8c1766b666566ebd /clang/test/SemaCXX/static-assert.cpp
parentc86715631cf936da5d94be15a07d14f0153f5b4c (diff)
downloadbcm5719-llvm-5bbe1d7ba74ed004b5f297185bf8f08e313b0c58.tar.gz
bcm5719-llvm-5bbe1d7ba74ed004b5f297185bf8f08e313b0c58.zip
More static_assert work. Check that the assert expr is valid and show an error if it's false. Create the declaration and add it to the current context.
llvm-svn: 66995
Diffstat (limited to 'clang/test/SemaCXX/static-assert.cpp')
-rw-r--r--clang/test/SemaCXX/static-assert.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/static-assert.cpp b/clang/test/SemaCXX/static-assert.cpp
new file mode 100644
index 00000000000..a2b0b52d5d1
--- /dev/null
+++ b/clang/test/SemaCXX/static-assert.cpp
@@ -0,0 +1,15 @@
+// RUN: clang -fsyntax-only -verify %s -std=c++0x
+
+int f();
+
+static_assert(f(), "f"); // expected-error {{static_assert expression is not an integral constant expression}}
+static_assert(true, "true is not false");
+static_assert(false, "false is false"); // expected-error {{static_assert failed "false is false"}}
+
+void g() {
+ static_assert(false, "false is false"); // expected-error {{static_assert failed "false is false"}}
+}
+
+class C {
+ static_assert(false, "false is false"); // expected-error {{static_assert failed "false is false"}}
+};
OpenPOWER on IntegriCloud