gcc/testsuite/gcc.dg/c99-tag-2.c
raw| 1 | /* Test for handling of tags. A struct defined in an inner scope does |
| 2 | not match one declared in an outer scope. */ |
| 3 | /* Origin: Joseph Myers <[email protected]> */ |
| 4 | /* { dg-do compile } */ |
| 5 | /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ |
| 6 | |
| 7 | struct s; |
| 8 | struct t { struct s *p; } x; |
| 9 | |
| 10 | void |
| 11 | f (void) |
| 12 | { |
| 13 | /* This is a different struct s from the outer one. */ |
| 14 | struct s { int a; } y; |
| 15 | x.p = &y; /* { dg-error "incompatible" } */ |
| 16 | } |