From 5e11b87c5f1203a21091ecc7b9b364af7583851b Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 7 Oct 1998 20:59:13 +0000 Subject: [PATCH] extern1.C: New test. * g++.old-deja/g++.ns/extern1.C: New test. Extern declarations within functions should introduce names into the innermost enclosing namespace From-SVN: r22902 --- gcc/testsuite/ChangeLog | 6 +++++- gcc/testsuite/g++.old-deja/g++.ns/extern1.C | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.ns/extern1.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 310ee0ed08e..78bddf1ab6c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,10 @@ 1998-10-08 Alexandre Oliva - * g++.old-deja/g++.other/init7.C: New test: retry initialization + * g++.old-deja/g++.ns/extern1.C: New test. Extern declarations + within functions should introduce names into the innermost + enclosing namespace + + * g++.old-deja/g++.other/init7.C: New test. Retry initialization of static locals if first initialization throws Wed Oct 7 12:00:20 1998 Jim Wilson diff --git a/gcc/testsuite/g++.old-deja/g++.ns/extern1.C b/gcc/testsuite/g++.old-deja/g++.ns/extern1.C new file mode 100644 index 00000000000..f4ab5ef9e74 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/extern1.C @@ -0,0 +1,18 @@ +// Build don't run: + +// Based on a testcase by eyal.ben-david@aks.com + +// An extern declaration of an undeclared object within a function +// introduces the object into the enclosing namespace [basic.link]/7 + +namespace { + void foo() { + extern int xx; // causes linker error - XFAIL *-*-* + xx = 0; + } + int xx = 1; +} + +int main() { + xx = 2; +} -- 2.30.2