Debian Codegraph @

gcc/testsuite/gdc.dg/pr97002.d

raw
1 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97002
2 // { dg-do compile }
3
4 import core.stdc.stdarg;
5
6 enum E1 : bool { one, two }
7 enum E2 : short { one, two }
8 enum E3 : dchar { one, two }
9 enum E4 : float { one, two }
10
11 extern(C) void fun(void *p1, ...)
12 {
13 va_arg!bool(_argptr); // { dg-warning "'bool' is promoted to 'int' when passed through '...'" "promoted" }
14 // { dg-message "note: .so you should pass .int. not .bool. to .va_arg.." "int not bool" { target *-*-* } .-1 }
15 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-2 }
16
17 va_arg!byte(_argptr); // { dg-warning "'byte' is promoted to 'int' when passed through '...'" "promoted" }
18 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
19
20 va_arg!ubyte(_argptr); // { dg-warning "'ubyte' is promoted to 'int' when passed through '...'" "promoted" }
21 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
22
23 va_arg!short(_argptr); // { dg-warning "'short' is promoted to 'int' when passed through '...'" "promoted" }
24 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
25
26 va_arg!ushort(_argptr); // { dg-warning "'ushort' is promoted to 'int' when passed through '...'" "promoted" }
27 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
28
29 va_arg!char(_argptr); // { dg-warning "'char' is promoted to 'int' when passed through '...'" "promoted" }
30 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
31
32 va_arg!wchar(_argptr); // { dg-warning "'wchar' is promoted to 'int' when passed through '...'" "promoted" }
33 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
34
35 va_arg!dchar(_argptr); // { dg-warning "'dchar' is promoted to 'uint' when passed through '...'" "promoted" }
36 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
37
38 va_arg!float(_argptr); // { dg-warning "'float' is promoted to 'double' when passed through '...'" "promoted" }
39 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
40
41 va_arg!ifloat(_argptr); // { dg-warning "'ifloat' is promoted to 'idouble' when passed through '...'" "promoted" }
42 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
43
44 va_arg!E1(_argptr); // { dg-warning "'E1' is promoted to 'int' when passed through '...'" "promoted" }
45 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
46
47 va_arg!E2(_argptr); // { dg-warning "'E2' is promoted to 'int' when passed through '...'" "promoted" }
48 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
49
50 va_arg!E3(_argptr); // { dg-warning "'E3' is promoted to 'uint' when passed through '...'" "promoted" }
51 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
52
53 va_arg!E4(_argptr); // { dg-warning "'E4' is promoted to 'double' when passed through '...'" "promoted" }
54 // { dg-message "note: if this code is reached, the program will abort" "will abort" { target *-*-* } .-1 }
55 }