xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/shift.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1 // RUN: %clang_cc1 -Wall -Wshift-sign-overflow -ffreestanding -fsyntax-only -verify %s
2 
3 #include <limits.h>
4 
5 #define WORD_BIT (sizeof(int) * CHAR_BIT)
6 
f()7 template <int N> void f() {
8   (void)(N << 30); // expected-warning {{bits to represent, but 'int' only has}}
9   (void)(30 << N); // expected-warning {{bits to represent, but 'int' only has}}
10 }
11 
test()12 void test() {
13   f<30>(); // expected-note {{instantiation}}
14 }
15