| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -Wsign-conversion %s |
| 2 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify -Wsign-conversion %s |
| 3 |
// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsyntax-only -verify -Wsign-conversion %s |
| 4 |
|
| 5 |
// PR9345: make a subgroup of -Wconversion for signedness changes |
| 6 |
|
| 7 |
void test(int x) { |
| 8 |
unsigned t0 = x; // expected-warning {{implicit conversion changes signedness}} |
| 9 |
unsigned t1 = (t0 == 5 ? x : 0); // expected-warning {{operand of ? changes signedness}} |
| 10 |
|
| 11 |
// Clang has special treatment for left shift of literal '1'. |
| 12 |
// Make sure there is no diagnostics. |
| 13 |
long t2 = 1LL << x; |
| 14 |
} |