Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.dg / gnu99-static-1.c
blobb600a4b1201d167fb0a48aaea6f16d649b713316
1 /* It is a constraint violation for a static function to be declared
2 but not defined if it is used except in a sizeof expression whose
3 result is an integer constant. In GNU C, we need to consider
4 __typeof__ and __alignof__ as well. __alignof__ always returns a
5 constant, so static functions can always be used therein.
6 __typeof__ evaluates its argument iff it has variably modified
7 type. */
8 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
9 /* { dg-do compile } */
10 /* { dg-options "-O2 -std=gnu99 -pedantic-errors" } */
12 /* __alignof__, OK. */
13 static int f0(void);
14 void g0(void) { __alignof__(f0()); }
16 /* __typeof__ not variably modified, OK. */
17 static int f1(void);
18 void g1(void) { __typeof__(f1()) x; }
20 /* __typeof__ variably modified, not OK. */
21 static int f2(void); /* { dg-error "used but never defined" } */
22 void g2(void) { __typeof__(int [f2()]) x; }
24 /* __typeof__ variably modified, not OK. */
25 static int f3(void); /* { dg-error "used but never defined" } */
26 void g3(void) { __typeof__(int (*)[f3()]) x; }
28 /* Integer sizeof of VM typeof, OK. */
29 static int f4(void);
30 void g4(void) { sizeof(__typeof__(int (*)[f3()])); }