1 /* { dg-do compile } */
2 /* { dg-options "-fpermissive -O -Wall -ftrack-macro-expansion=0" } */
4 /* C99 6.2.7: Compatible type and composite type. */
6 #define DECIMAL_COMPOSITE_DECL(TYPE) \
7 _Decimal##TYPE g1_##TYPE(); \
8 _Decimal##TYPE g2_##TYPE(); \
9 _Decimal##TYPE (*h1_##TYPE)[2]; \
10 _Decimal##TYPE (*h2_##TYPE)[3]; \
11 _Decimal##TYPE (*h3_##TYPE)[4]; \
12 _Decimal##TYPE f1_##TYPE(_Decimal##TYPE(*)()); \
13 _Decimal##TYPE f1_##TYPE(_Decimal##TYPE(*)(_Decimal##TYPE*)); \
14 _Decimal##TYPE f1_##TYPE (_Decimal##TYPE(*g)(_Decimal##TYPE*)) \
16 _Decimal##TYPE d##TYPE; \
17 d##TYPE = ((_Decimal##TYPE (*) (_Decimal##TYPE*)) g)(&d##TYPE); \
18 d##TYPE = ((_Decimal##TYPE (*) ()) g); \
21 _Decimal##TYPE f2_##TYPE(_Decimal##TYPE(*)[]); \
22 _Decimal##TYPE f2_##TYPE(_Decimal##TYPE(*)[3]);
24 #define DECIMAL_COMPOSITE_TEST(TYPE) \
27 _Decimal##TYPE d##TYPE; \
28 d##TYPE = f1_##TYPE(g1_##TYPE); \
29 d##TYPE = f1_##TYPE(g2_##TYPE); \
30 d##TYPE = f2_##TYPE(h1_##TYPE); \
31 d##TYPE = f2_##TYPE(h2_##TYPE); \
32 d##TYPE = f2_##TYPE(h3_##TYPE); \
36 DECIMAL_COMPOSITE_DECL(32); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
37 /* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } .-1 } */
40 DECIMAL_COMPOSITE_DECL(64); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
41 /* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } .-1 } */
44 DECIMAL_COMPOSITE_DECL(128); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
45 /* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } .-1 } */
50 DECIMAL_COMPOSITE_TEST(32); /* { dg-warning "incompatible pointer type" } */
51 DECIMAL_COMPOSITE_TEST(64); /* { dg-warning "incompatible pointer type" } */
52 DECIMAL_COMPOSITE_TEST(128); /* { dg-warning "incompatible pointer type" } */
57 /* The invalid function redeclarations might also trigger:
58 { dg-prune-output "-Warray-parameter" } */