Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / c90-static-1.c
blobcc6f320c5a26e3b1b03dea30f51c9979e9c347be
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. The
3 use of the function simply being unevaluated is not enough. */
4 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "-O2 -std=iso9899:1990 -pedantic-errors" } */
8 /* Constraint violation (trivial case, where function is used). */
9 static void f0(void); /* { dg-error "used but never defined" } */
10 void g0(void) { f0(); }
12 /* Constraint violation. */
13 static void f1(void); /* { dg-error "used but never defined" } */
14 void g1(void) { if (0) { f1(); } }
16 /* Constraint violation. */
17 static int f2(void); /* { dg-error "used but never defined" } */
18 void g2(void) { 0 ? f2() : 0; }
20 /* OK. */
21 static int f3(void);
22 void g3(void) { sizeof(f3()); }