summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/static-assert.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/static-assert.cpp')
-rw-r--r--test/SemaCXX/static-assert.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/SemaCXX/static-assert.cpp b/test/SemaCXX/static-assert.cpp
index 364e4e4..4a7560b 100644
--- a/test/SemaCXX/static-assert.cpp
+++ b/test/SemaCXX/static-assert.cpp
@@ -34,3 +34,17 @@ static_assert(false, u"\U000317FF"); // expected-error {{static_assert failed u"
static_assert(false, u8"Ω"); // expected-error {{static_assert failed u8"\316\251"}}
static_assert(false, L"\u1234"); // expected-error {{static_assert failed L"\x1234"}}
static_assert(false, L"\x1ff" "0\x123" "fx\xfffff" "goop"); // expected-error {{static_assert failed L"\x1FF""0\x123""fx\xFFFFFgoop"}}
+
+template<typename T> struct AlwaysFails {
+ // Only give one error here.
+ static_assert(false, ""); // expected-error {{static_assert failed}}
+};
+AlwaysFails<int> alwaysFails;
+
+template<typename T> struct StaticAssertProtected {
+ static_assert(__is_literal(T), ""); // expected-error {{static_assert failed}}
+ static constexpr T t = {}; // no error here
+};
+struct X { ~X(); };
+StaticAssertProtected<int> sap1;
+StaticAssertProtected<X> sap2; // expected-note {{instantiation}}
OpenPOWER on IntegriCloud