comparison gcc/testsuite/gcc.dg/c90-static-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
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" } */
7
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(); }
11
12 /* Constraint violation. */
13 static void f1(void); /* { dg-error "used but never defined" } */
14 void g1(void) { if (0) { f1(); } }
15
16 /* Constraint violation. */
17 static int f2(void); /* { dg-error "used but never defined" } */
18 void g2(void) { 0 ? f2() : 0; }
19
20 /* OK. */
21 static int f3(void);
22 void g3(void) { sizeof(f3()); }