]>
Commit | Line | Data |
---|---|---|
cb4d9ee2 | 1 | /* PR c/81417 */ |
2 | /* { dg-do compile } */ | |
3 | /* { dg-options "-Wsign-compare -fdiagnostics-show-caret" } */ | |
4 | ||
5 | unsigned int | |
6 | f0 (int x, unsigned int y) | |
7 | { | |
85b9be9b | 8 | return x ? y : -1; /* { dg-warning "18:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */ |
cb4d9ee2 | 9 | /* { dg-begin-multiline-output "" } |
10 | return x ? y : -1; | |
11 | ^~ | |
12 | { dg-end-multiline-output "" } */ | |
13 | } | |
14 | ||
15 | unsigned int | |
16 | f1 (int xxx, unsigned int yyy) | |
17 | { | |
85b9be9b | 18 | return xxx ? yyy : -1; /* { dg-warning "22:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */ |
cb4d9ee2 | 19 | /* { dg-begin-multiline-output "" } |
20 | return xxx ? yyy : -1; | |
21 | ^~ | |
22 | { dg-end-multiline-output "" } */ | |
23 | } | |
24 | ||
25 | unsigned int | |
26 | f2 (int xxx, unsigned int yyy) | |
27 | { | |
85b9be9b | 28 | return xxx ? -1 : yyy; /* { dg-warning "16:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */ |
cb4d9ee2 | 29 | /* { dg-begin-multiline-output "" } |
30 | return xxx ? -1 : yyy; | |
31 | ^~ | |
32 | { dg-end-multiline-output "" } */ | |
33 | } | |
34 | ||
35 | unsigned int | |
36 | f3 (unsigned int yyy) | |
37 | { | |
85b9be9b | 38 | return yyy ?: -1; /* { dg-warning "17:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */ |
cb4d9ee2 | 39 | /* { dg-begin-multiline-output "" } |
40 | return yyy ?: -1; | |
41 | ^~ | |
42 | { dg-end-multiline-output "" } */ | |
43 | } | |
44 | ||
45 | unsigned int | |
46 | f4 (int xxx, unsigned yyy, short uuu) | |
47 | { | |
85b9be9b | 48 | return xxx ? yyy : uuu; /* { dg-warning "22:operand of '\\?:' changes signedness from 'short int' to 'unsigned int'" } */ |
cb4d9ee2 | 49 | /* { dg-begin-multiline-output "" } |
50 | return xxx ? yyy : uuu; | |
51 | ^~~ | |
52 | { dg-end-multiline-output "" } */ | |
53 | } | |
54 | ||
55 | unsigned int | |
56 | f5 (int xxx, unsigned yyy, short uuu) | |
57 | { | |
85b9be9b | 58 | return xxx ? uuu : yyy; /* { dg-warning "16:operand of '\\?:' changes signedness from 'short int' to 'unsigned int'" } */ |
cb4d9ee2 | 59 | /* { dg-begin-multiline-output "" } |
60 | return xxx ? uuu : yyy; | |
61 | ^~~ | |
62 | { dg-end-multiline-output "" } */ | |
63 | } | |
64 | ||
65 | unsigned int | |
66 | f6 (int xxx, unsigned yyy, signed char uuu) | |
67 | { | |
85b9be9b | 68 | return xxx ? yyy : uuu; /* { dg-warning "22:operand of '\\?:' changes signedness from 'signed char' to 'unsigned int'" } */ |
cb4d9ee2 | 69 | /* { dg-begin-multiline-output "" } |
70 | return xxx ? yyy : uuu; | |
71 | ^~~ | |
72 | { dg-end-multiline-output "" } */ | |
73 | } | |
74 | ||
75 | unsigned int | |
76 | f7 (int xxx, unsigned yyy, signed char uuu) | |
77 | { | |
85b9be9b | 78 | return xxx ? uuu : yyy; /* { dg-warning "16:operand of '\\?:' changes signedness from 'signed char' to 'unsigned int'" } */ |
cb4d9ee2 | 79 | /* { dg-begin-multiline-output "" } |
80 | return xxx ? uuu : yyy; | |
81 | ^~~ | |
82 | { dg-end-multiline-output "" } */ | |
83 | } |