brintos

brintos / llvm-project-archived public Read only

0
0
Text · 580 B · ce26b78 Raw
23 lines · c
1// RUN: %check_clang_tidy %s bugprone-narrowing-conversions %t -- \2// RUN: -- -target x86_64-unknown-linux3 4char test_char(int cond, char c) {5	char ret = cond > 0 ? ':' : c;6	return ret;7}8 9short test_short(int cond, short s) {10	short ret = cond > 0 ? ':' : s;11	return ret;12}13 14int test_int(int cond, int i) {15	int ret = cond > 0 ? ':' : i;16	return ret;17}18 19void test(int cond, int i) {20  char x = cond > 0 ? ':' : i;21  // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: narrowing conversion from 'int' to signed type 'char' is implementation-defined [bugprone-narrowing-conversions]22}23