1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-constant-conversion %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-constant-conversion -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-constant-conversion -std=c++11 %s
9 // Result of ! must be type bool.
15 extern void f0_1(int*);
17 #if __cplusplus >= 201103L // C++11 or later
18 // expected-warning@-2 {{'register' storage class specifier is deprecated}}
24 template <class T
> void bar(T
&x
) { T::fail(); }
25 template <class T
> void bar(volatile T
&x
) {}
37 bar(x
+= E_zero
); // expected-error {{incompatible type}}
42 return x
&& 4; // expected-warning {{use of logical '&&' with constant operand}} \
43 // expected-note {{use '&' for a bitwise operation}} \
44 // expected-note {{remove constant to silence this warning}}
46 return x
&& sizeof(int) == 4; // no warning, RHS is logical op.
52 return x
&& (unsigned)0; // expected-warning {{use of logical '&&' with constant operand}} \
53 // expected-note {{use '&' for a bitwise operation}} \
54 // expected-note {{remove constant to silence this warning}}
56 return x
|| (unsigned)1; // expected-warning {{use of logical '||' with constant operand}} \
57 // expected-note {{use '|' for a bitwise operation}}
59 return x
|| 0; // expected-warning {{use of logical '||' with constant operand}} \
60 // expected-note {{use '|' for a bitwise operation}}
61 return x
|| 1; // expected-warning {{use of logical '||' with constant operand}} \
62 // expected-note {{use '|' for a bitwise operation}}
63 return x
|| -1; // expected-warning {{use of logical '||' with constant operand}} \
64 // expected-note {{use '|' for a bitwise operation}}
65 return x
|| 5; // expected-warning {{use of logical '||' with constant operand}} \
66 // expected-note {{use '|' for a bitwise operation}}
67 return x
&& 0; // expected-warning {{use of logical '&&' with constant operand}} \
68 // expected-note {{use '&' for a bitwise operation}} \
69 // expected-note {{remove constant to silence this warning}}
70 return x
&& 1; // expected-warning {{use of logical '&&' with constant operand}} \
71 // expected-note {{use '&' for a bitwise operation}} \
72 // expected-note {{remove constant to silence this warning}}
73 return x
&& -1; // expected-warning {{use of logical '&&' with constant operand}} \
74 // expected-note {{use '&' for a bitwise operation}} \
75 // expected-note {{remove constant to silence this warning}}
76 return x
&& 5; // expected-warning {{use of logical '&&' with constant operand}} \
77 // expected-note {{use '&' for a bitwise operation}} \
78 // expected-note {{remove constant to silence this warning}}
79 return x
|| (0); // expected-warning {{use of logical '||' with constant operand}} \
80 // expected-note {{use '|' for a bitwise operation}}
81 return x
|| (1); // expected-warning {{use of logical '||' with constant operand}} \
82 // expected-note {{use '|' for a bitwise operation}}
83 return x
|| (-1); // expected-warning {{use of logical '||' with constant operand}} \
84 // expected-note {{use '|' for a bitwise operation}}
85 return x
|| (5); // expected-warning {{use of logical '||' with constant operand}} \
86 // expected-note {{use '|' for a bitwise operation}}
87 return x
&& (0); // expected-warning {{use of logical '&&' with constant operand}} \
88 // expected-note {{use '&' for a bitwise operation}} \
89 // expected-note {{remove constant to silence this warning}}
90 return x
&& (1); // expected-warning {{use of logical '&&' with constant operand}} \
91 // expected-note {{use '&' for a bitwise operation}} \
92 // expected-note {{remove constant to silence this warning}}
93 return x
&& (-1); // expected-warning {{use of logical '&&' with constant operand}} \
94 // expected-note {{use '&' for a bitwise operation}} \
95 // expected-note {{remove constant to silence this warning}}
96 return x
&& (5); // expected-warning {{use of logical '&&' with constant operand}} \
97 // expected-note {{use '&' for a bitwise operation}} \
98 // expected-note {{remove constant to silence this warning}}
101 template<unsigned int A
, unsigned int B
> struct S
105 e2
= A
&& 7 // expected-warning {{use of logical '&&' with constant operand}} \
106 // expected-note {{use '&' for a bitwise operation}} \
107 // expected-note {{remove constant to silence this warning}}
112 int y
= B
&& 3; // expected-warning {{use of logical '&&' with constant operand}} \
113 // expected-note {{use '&' for a bitwise operation}} \
114 // expected-note {{remove constant to silence this warning}}
140 bool r2
= X
|| Y2
; // expected-warning {{use of logical '||' with constant operand}} \
141 // expected-note {{use '|' for a bitwise operation}}