aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/bool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/bool.cpp')
-rw-r--r--test/SemaCXX/bool.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/SemaCXX/bool.cpp b/test/SemaCXX/bool.cpp
index bc44c73d8cac..259c09c6cb83 100644
--- a/test/SemaCXX/bool.cpp
+++ b/test/SemaCXX/bool.cpp
@@ -16,3 +16,15 @@ void test(bool b)
bool *b1 = (int *)0; // expected-error{{expected 'bool *'}}
}
+
+// static_assert_arg_is_bool(x) compiles only if x is a bool.
+template <typename T>
+void static_assert_arg_is_bool(T x) {
+ bool* p = &x;
+}
+
+void test2() {
+ int n = 2;
+ static_assert_arg_is_bool(n && 4);
+ static_assert_arg_is_bool(n || 5);
+}