| 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 <[email protected]> */ |
| 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()); } |