1 |
298 |
jeremybenn |
/* { dg-do compile } */
|
2 |
|
|
/* { dg-options "-O -Wall" } */
|
3 |
|
|
|
4 |
|
|
/* C99 6.2.7: Compatible type and composite type. */
|
5 |
|
|
|
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*)) \
|
15 |
|
|
{ \
|
16 |
|
|
_Decimal##TYPE d##TYPE; \
|
17 |
|
|
d##TYPE = ((_Decimal##TYPE (*) (_Decimal##TYPE*)) g)(&d##TYPE); \
|
18 |
|
|
d##TYPE = ((_Decimal##TYPE (*) ()) g); \
|
19 |
|
|
return d##TYPE; \
|
20 |
|
|
} \
|
21 |
|
|
_Decimal##TYPE f2_##TYPE(_Decimal##TYPE(*)[]); \
|
22 |
|
|
_Decimal##TYPE f2_##TYPE(_Decimal##TYPE(*)[3]);
|
23 |
|
|
|
24 |
|
|
#define DECIMAL_COMPOSITE_TEST(TYPE) \
|
25 |
|
|
do \
|
26 |
|
|
{ \
|
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); \
|
33 |
|
|
} while(0)
|
34 |
|
|
|
35 |
|
|
DECIMAL_COMPOSITE_DECL(32); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
|
36 |
|
|
/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 35 } */
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
DECIMAL_COMPOSITE_DECL(64); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
|
40 |
|
|
/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 39 } */
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
DECIMAL_COMPOSITE_DECL(128); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
|
44 |
|
|
/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 43 } */
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
int main()
|
48 |
|
|
{
|
49 |
|
|
DECIMAL_COMPOSITE_TEST(32); /* { dg-warning "incompatible pointer type" } */
|
50 |
|
|
DECIMAL_COMPOSITE_TEST(64); /* { dg-warning "incompatible pointer type" } */
|
51 |
|
|
DECIMAL_COMPOSITE_TEST(128); /* { dg-warning "incompatible pointer type" } */
|
52 |
|
|
|
53 |
|
|
return 0;
|
54 |
|
|
}
|