1 /* { dg-do compile } */
2 /* { dg-options "-std=gnu99 -O -Wall -Wno-unused -ftrack-macro-expansion=0" } */
4 /* C99 6.2.7: Compatible type and composite type. */
6 #define FIXED_POINT_COMPOSITE_DECL(TYPE,NAME) \
9 TYPE (*h1_##NAME)[2]; \
10 TYPE (*h2_##NAME)[3]; \
11 TYPE (*h3_##NAME)[4]; \
12 TYPE f1_##NAME(TYPE(*)()); \
13 TYPE f1_##NAME(TYPE(*)(TYPE*)); \
14 TYPE f1_##NAME (TYPE(*g)(TYPE*)) \
17 NAME = ((TYPE (*) (TYPE*)) g)(&NAME); \
18 NAME = ((TYPE (*) ()) g); \
21 TYPE f2_##NAME(TYPE(*)[]); \
22 TYPE f2_##NAME(TYPE(*)[3]);
24 #define FIXED_POINT_COMPOSITE_TEST(TYPE, NAME) \
28 NAME = f1_##NAME(g1_##NAME); \
29 NAME = f1_##NAME(g2_##NAME); \
30 NAME = f2_##NAME(h1_##NAME); \
31 NAME = f2_##NAME(h2_##NAME); \
32 NAME = f2_##NAME(h3_##NAME); \
35 FIXED_POINT_COMPOSITE_DECL(short _Fract
, sf
); /* { dg-error "incompatible types when assigning" } */
36 FIXED_POINT_COMPOSITE_DECL(_Fract
, f
); /* { dg-error "incompatible types when assigning" } */
37 FIXED_POINT_COMPOSITE_DECL(long _Fract
, lf
); /* { dg-error "incompatible types when assigning" } */
38 FIXED_POINT_COMPOSITE_DECL(long long _Fract
, llf
); /* { dg-error "incompatible types when assigning" } */
39 FIXED_POINT_COMPOSITE_DECL(unsigned short _Fract
, usf
); /* { dg-error "incompatible types when assigning" } */
40 FIXED_POINT_COMPOSITE_DECL(unsigned _Fract
, uf
); /* { dg-error "incompatible types when assigning" } */
41 FIXED_POINT_COMPOSITE_DECL(unsigned long _Fract
, ulf
); /* { dg-error "incompatible types when assigning" } */
42 FIXED_POINT_COMPOSITE_DECL(unsigned long long _Fract
, ullf
); /* { dg-error "incompatible types when assigning" } */
43 FIXED_POINT_COMPOSITE_DECL(_Sat
short _Fract
, Ssf
); /* { dg-error "incompatible types when assigning" } */
44 FIXED_POINT_COMPOSITE_DECL(_Sat _Fract
, Sf
); /* { dg-error "incompatible types when assigning" } */
45 FIXED_POINT_COMPOSITE_DECL(_Sat
long _Fract
, Slf
); /* { dg-error "incompatible types when assigning" } */
46 FIXED_POINT_COMPOSITE_DECL(_Sat
long long _Fract
, Sllf
); /* { dg-error "incompatible types when assigning" } */
47 FIXED_POINT_COMPOSITE_DECL(_Sat
unsigned short _Fract
, Susf
); /* { dg-error "incompatible types when assigning" } */
48 FIXED_POINT_COMPOSITE_DECL(_Sat
unsigned _Fract
, Suf
); /* { dg-error "incompatible types when assigning" } */
49 FIXED_POINT_COMPOSITE_DECL(_Sat
unsigned long _Fract
, Sulf
); /* { dg-error "incompatible types when assigning" } */
50 FIXED_POINT_COMPOSITE_DECL(_Sat
unsigned long long _Fract
, Sullf
); /* { dg-error "incompatible types when assigning" } */
52 FIXED_POINT_COMPOSITE_DECL(short _Accum
, sk
); /* { dg-error "incompatible types when assigning" } */
53 FIXED_POINT_COMPOSITE_DECL(_Accum
, k
); /* { dg-error "incompatible types when assigning" } */
54 FIXED_POINT_COMPOSITE_DECL(long _Accum
, lk
); /* { dg-error "incompatible types when assigning" } */
55 FIXED_POINT_COMPOSITE_DECL(long long _Accum
, llk
); /* { dg-error "incompatible types when assigning" } */
56 FIXED_POINT_COMPOSITE_DECL(unsigned short _Accum
, usk
); /* { dg-error "incompatible types when assigning" } */
57 FIXED_POINT_COMPOSITE_DECL(unsigned _Accum
, uk
); /* { dg-error "incompatible types when assigning" } */
58 FIXED_POINT_COMPOSITE_DECL(unsigned long _Accum
, ulk
); /* { dg-error "incompatible types when assigning" } */
59 FIXED_POINT_COMPOSITE_DECL(unsigned long long _Accum
, ullk
); /* { dg-error "incompatible types when assigning" } */
60 FIXED_POINT_COMPOSITE_DECL(_Sat
short _Accum
, Ssk
); /* { dg-error "incompatible types when assigning" } */
61 FIXED_POINT_COMPOSITE_DECL(_Sat _Accum
, Sk
); /* { dg-error "incompatible types when assigning" } */
62 FIXED_POINT_COMPOSITE_DECL(_Sat
long _Accum
, Slk
); /* { dg-error "incompatible types when assigning" } */
63 FIXED_POINT_COMPOSITE_DECL(_Sat
long long _Accum
, Sllk
); /* { dg-error "incompatible types when assigning" } */
64 FIXED_POINT_COMPOSITE_DECL(_Sat
unsigned short _Accum
, Susk
); /* { dg-error "incompatible types when assigning" } */
65 FIXED_POINT_COMPOSITE_DECL(_Sat
unsigned _Accum
, Suk
); /* { dg-error "incompatible types when assigning" } */
66 FIXED_POINT_COMPOSITE_DECL(_Sat
unsigned long _Accum
, Sulk
); /* { dg-error "incompatible types when assigning" } */
67 FIXED_POINT_COMPOSITE_DECL(_Sat
unsigned long long _Accum
, Sullk
); /* { dg-error "incompatible types when assigning" } */
71 FIXED_POINT_COMPOSITE_TEST(short _Fract
, sf
); /* { dg-warning "incompatible pointer type" } */
72 FIXED_POINT_COMPOSITE_TEST(_Fract
, f
); /* { dg-warning "incompatible pointer type" } */
73 FIXED_POINT_COMPOSITE_TEST(long _Fract
, lf
); /* { dg-warning "incompatible pointer type" } */
74 FIXED_POINT_COMPOSITE_TEST(long long _Fract
, llf
); /* { dg-warning "incompatible pointer type" } */
75 FIXED_POINT_COMPOSITE_TEST(unsigned short _Fract
, usf
); /* { dg-warning "incompatible pointer type" } */
76 FIXED_POINT_COMPOSITE_TEST(unsigned _Fract
, uf
); /* { dg-warning "incompatible pointer type" } */
77 FIXED_POINT_COMPOSITE_TEST(unsigned long _Fract
, ulf
); /* { dg-warning "incompatible pointer type" } */
78 FIXED_POINT_COMPOSITE_TEST(unsigned long long _Fract
, ullf
); /* { dg-warning "incompatible pointer type" } */
79 FIXED_POINT_COMPOSITE_TEST(_Sat
short _Fract
, Ssf
); /* { dg-warning "incompatible pointer type" } */
80 FIXED_POINT_COMPOSITE_TEST(_Sat _Fract
, Sf
); /* { dg-warning "incompatible pointer type" } */
81 FIXED_POINT_COMPOSITE_TEST(_Sat
long _Fract
, Slf
); /* { dg-warning "incompatible pointer type" } */
82 FIXED_POINT_COMPOSITE_TEST(_Sat
long long _Fract
, Sllf
); /* { dg-warning "incompatible pointer type" } */
83 FIXED_POINT_COMPOSITE_TEST(_Sat
unsigned short _Fract
, Susf
); /* { dg-warning "incompatible pointer type" } */
84 FIXED_POINT_COMPOSITE_TEST(_Sat
unsigned _Fract
, Suf
); /* { dg-warning "incompatible pointer type" } */
85 FIXED_POINT_COMPOSITE_TEST(_Sat
unsigned long _Fract
, Sulf
); /* { dg-warning "incompatible pointer type" } */
86 FIXED_POINT_COMPOSITE_TEST(_Sat
unsigned long long _Fract
, Sullf
); /* { dg-warning "incompatible pointer type" } */
88 FIXED_POINT_COMPOSITE_TEST(short _Accum
, sk
); /* { dg-warning "incompatible pointer type" } */
89 FIXED_POINT_COMPOSITE_TEST(_Accum
, k
); /* { dg-warning "incompatible pointer type" } */
90 FIXED_POINT_COMPOSITE_TEST(long _Accum
, lk
); /* { dg-warning "incompatible pointer type" } */
91 FIXED_POINT_COMPOSITE_TEST(long long _Accum
, llk
); /* { dg-warning "incompatible pointer type" } */
92 FIXED_POINT_COMPOSITE_TEST(unsigned short _Accum
, usk
); /* { dg-warning "incompatible pointer type" } */
93 FIXED_POINT_COMPOSITE_TEST(unsigned _Accum
, uk
); /* { dg-warning "incompatible pointer type" } */
94 FIXED_POINT_COMPOSITE_TEST(unsigned long _Accum
, ulk
); /* { dg-warning "incompatible pointer type" } */
95 FIXED_POINT_COMPOSITE_TEST(unsigned long long _Accum
, ullk
); /* { dg-warning "incompatible pointer type" } */
96 FIXED_POINT_COMPOSITE_TEST(_Sat
short _Accum
, Ssk
); /* { dg-warning "incompatible pointer type" } */
97 FIXED_POINT_COMPOSITE_TEST(_Sat _Accum
, Sk
); /* { dg-warning "incompatible pointer type" } */
98 FIXED_POINT_COMPOSITE_TEST(_Sat
long _Accum
, Slk
); /* { dg-warning "incompatible pointer type" } */
99 FIXED_POINT_COMPOSITE_TEST(_Sat
long long _Accum
, Sllk
); /* { dg-warning "incompatible pointer type" } */
100 FIXED_POINT_COMPOSITE_TEST(_Sat
unsigned short _Accum
, Susk
); /* { dg-warning "incompatible pointer type" } */
101 FIXED_POINT_COMPOSITE_TEST(_Sat
unsigned _Accum
, Suk
); /* { dg-warning "incompatible pointer type" } */
102 FIXED_POINT_COMPOSITE_TEST(_Sat
unsigned long _Accum
, Sulk
); /* { dg-warning "incompatible pointer type" } */
103 FIXED_POINT_COMPOSITE_TEST(_Sat
unsigned long long _Accum
, Sullk
); /* { dg-warning "incompatible pointer type" } */
108 /* Match all extra informative notes. */
109 /* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" { target *-*-* } 0 } */