1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-constant-conversion %s
3 // Bool literals can be enum values.
9 // bool cannot be decremented, and gives a warning on increment
12 ++b; // expected-warning {{incrementing expression of type bool is deprecated}}
13 b++; // expected-warning {{incrementing expression of type bool is deprecated}}
14 --b; // expected-error {{cannot decrement expression of type bool}}
15 b--; // expected-error {{cannot decrement expression of type bool}}
17 bool *b1 = (int *)0; // expected-error{{cannot initialize}}
20 // static_assert_arg_is_bool(x) compiles only if x is a bool.
22 void static_assert_arg_is_bool(T x) {
28 static_assert_arg_is_bool(n && 4); // expected-warning {{use of logical '&&' with constant operand}} \
29 // expected-note {{use '&' for a bitwise operation}} \
30 // expected-note {{remove constant to silence this warning}}
31 static_assert_arg_is_bool(n || 5); // expected-warning {{use of logical '||' with constant operand}} \
32 // expected-note {{use '|' for a bitwise operation}}