gcc/testsuite/g++.old-deja/g++.ns/extern1.C
raw| 1 | // { dg-do link } |
| 2 | |
| 3 | // Based on a testcase by [email protected] |
| 4 | |
| 5 | // An extern declaration of an undeclared object within a function |
| 6 | // introduces the object into the enclosing namespace [basic.link]/7 |
| 7 | |
| 8 | namespace { |
| 9 | void foo() { |
| 10 | extern int xx; |
| 11 | xx = 0; |
| 12 | } |
| 13 | int xx = 1; |
| 14 | } |
| 15 | |
| 16 | int main() { |
| 17 | xx = 2; |
| 18 | } |