Chandler Carruth | 6c3c3f5 | 2011-02-24 00:03:53 +0000 | [diff] [blame] | 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 | |
| 7 | template <int N> void f() { |
Chandler Carruth | 5fa05cb | 2011-02-24 17:13:15 +0000 | [diff] [blame] | 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}} |
Chandler Carruth | 6c3c3f5 | 2011-02-24 00:03:53 +0000 | [diff] [blame] | 10 | } |
| 11 | |
| 12 | void test() { |
| 13 | f<30>(); // expected-note {{instantiation}} |
| 14 | } |