brintos

brintos / llvm-project-archived public Read only

0
0
Text · 557 B · f3b00aa Raw
28 lines · c
1// RUN: %clang_cc1 -fsyntax-only -Wshift-bool -verify %s2 3void t() {4  int x = 10;5  int y = 5;6 7  int a = (x < y) << 1;8  int b = (x < y) >> 1;9 10  int c = (x > y) << 1;11  int d = (x > y) >> 1;12 13  int e = (x == y) << 1;14  int f = (x == y) >> 1;15 16  int g = (x != y) << 1;17  int h = (x != y) >> 1;18 19  int i = (x < y) << 0;20  int j = (x < y) >> 0;21 22  int k = (x < y) << -1; // expected-warning {{shift count is negative}}23  int l = (x < y) >> -1; // expected-warning {{shift count is negative}}24 25  if (((x < y) << 1) != 0) { }26  if (((x < y) >> 1) != 0) { }27}28