[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / warn-sign-conversion-cpp11.cpp
blobe18b7f56454325862432a3fb361390ffa04eb320
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wsign-conversion -std=c++11 %s
3 unsigned int test() {
4 short foo;
5 return foo; // expected-warning {{implicit conversion changes signedness}}
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}}
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;