Add aliases in nested blocks
authorMartin v. Löwis <loewis@gcc.gnu.org>
Wed, 15 Jul 1998 14:38:06 +0000 (14:38 +0000)
committerMartin v. Löwis <loewis@gcc.gnu.org>
Wed, 15 Jul 1998 14:38:06 +0000 (14:38 +0000)
From-SVN: r21197

gcc/testsuite/g++.old-deja/g++.ns/alias6.C

index 130d51ece0f1274990e0d6ebf93a8167ff9354de..b0799abf775823d20950b44b4df6c8410201cb7c 100644 (file)
@@ -1,16 +1,35 @@
+// Check namespace aliases inside blocks
 namespace A { 
   int i;
-  void f(){}
+  void f(){
+    i = 0;
+  }
 }
 
-main ()
+int g();
+
+int main ()
 {
   namespace B = A;
   B::i=42;
   B::f();
   using namespace B;
   f();
+  // A::i is now 0, B::i is 1
+  return g();
 }
 
-namespace B {}
+namespace B {
+  int i = 1;
+}
 
+int g()
+{
+  namespace x = A;
+  if (x::i)
+  {
+    namespace x = B;
+    return x::i;
+  }
+  return x::i;
+}