1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wsign-conversion -std=c++11 %s |
2 | |
3 | unsigned int test() { |
4 | short foo; |
5 | return foo; // expected-warning {{implicit conversion changes signedness}} |
6 | |
7 | } |
8 | |
9 | unsigned int test3() { |
10 | // For a non-defined enum, use the underlying type. |
11 | enum u8 : signed char; |
12 | u8 foo{static_cast<u8>(0)}; |
13 | return foo; // expected-warning {{implicit conversion changes signedness}} |
14 | |
15 | } |
16 | unsigned int test2() { |
17 | // For a non-defined enum, use the underlying type. |
18 | enum u8 : unsigned char; |
19 | u8 foo{static_cast<u8>(0)}; |
20 | return foo; |
21 | } |
22 | |