extern1.C: New test.
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Wed, 7 Oct 1998 20:59:13 +0000 (20:59 +0000)
committerAlexandre Oliva <oliva@gcc.gnu.org>
Wed, 7 Oct 1998 20:59:13 +0000 (20:59 +0000)
* 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
gcc/testsuite/g++.old-deja/g++.ns/extern1.C [new file with mode: 0644]

index 310ee0ed08ef730d9e59cd1447d767cb34bbcf14..78bddf1ab6ce71f81e6be814d943b8bb141b1b3d 100644 (file)
@@ -1,6 +1,10 @@
 1998-10-08  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
-       * 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  <wilson@cygnus.com>
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 (file)
index 0000000..f4ab5ef
--- /dev/null
@@ -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;
+}