File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -fsyntax-only -Wshift-bool -verify %s
2+
3+ void t () {
4+ int x = 10 ;
5+ int y = 1 ;
6+
7+ int a = y << x ;
8+ int b = y >> x ;
9+
10+ int c = 0 << x ;
11+ int d = 0 >> x ;
12+
13+ int e = y << 1 ;
14+ int f = y >> 1 ;
15+
16+ int g = y << -1 ; // expected-warning {{shift count is negative}}
17+ int h = y >> -1 ; // expected-warning {{shift count is negative}}
18+
19+ int i = y << 0 ;
20+ int j = y >> 0 ;
21+
22+ if ((y << 1 ) != 0 ) { }
23+ if ((y >> 1 ) != 0 ) { }
24+ }
Original file line number Diff line number Diff line change 33void t () {
44 int x = 10 ;
55 bool y = true ;
6- int z = 1 ;
76
87 bool a = y << x;
98 bool b = y >> x; // expected-warning {{right shifting a 'bool' implicitly converts it to 'int'}}
@@ -23,6 +22,4 @@ void t() {
2322
2423 if ((y << 1 ) != 0 ) { }
2524 if ((y >> 1 ) != 0 ) { } // expected-warning {{right shifting a 'bool' implicitly converts it to 'int'}}
26-
27- bool k = (x < z) >> 1 ; // expected-warning {{right shifting a 'bool' implicitly converts it to 'int'}}
2825}
You can’t perform that action at this time.
0 commit comments