blob: e18b7f56454325862432a3fb361390ffa04eb320 [file] [log] [blame]
Erich Keane05eac272017-09-21 20:14:08 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wsign-conversion -std=c++11 %s
2
3unsigned int test() {
4 short foo;
5 return foo; // expected-warning {{implicit conversion changes signedness}}
6
7}
8
9unsigned 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}
16unsigned 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}