don't seem to have been covered by our tests previously.
This should fix bootstrap failure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126345
91177308-0d34-0410-b5e6-
96231b3b80d8
// integers have defined behavior modulo one more than the maximum value
// representable in the result type, so never warn for those.
llvm::APSInt Left;
- if (!lex->isIntegerConstantExpr(Left, S.Context) ||
+ if (lex->isValueDependent() || !lex->isIntegerConstantExpr(Left, S.Context) ||
LHSTy->hasUnsignedIntegerRepresentation())
return;
llvm::APInt ResultBits =
--- /dev/null
+// RUN: %clang_cc1 -Wall -Wshift-sign-overflow -ffreestanding -fsyntax-only -verify %s
+
+#include <limits.h>
+
+#define WORD_BIT (sizeof(int) * CHAR_BIT)
+
+template <int N> void f() {
+ (void)(N << 30); // expected-warning {{the promoted type of the shift expression is 'int'}}
+ (void)(30 << N); // expected-warning {{the promoted type of the shift expression is 'int'}}
+}
+
+void test() {
+ f<30>(); // expected-note {{instantiation}}
+}