From 2d2ad82da4fdd52b434a7202f77a63ebc330366d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Wed, 15 Jul 1998 14:38:06 +0000 Subject: [PATCH] Add aliases in nested blocks From-SVN: r21197 --- gcc/testsuite/g++.old-deja/g++.ns/alias6.C | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/g++.old-deja/g++.ns/alias6.C b/gcc/testsuite/g++.old-deja/g++.ns/alias6.C index 130d51ece0f..b0799abf775 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/alias6.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/alias6.C @@ -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; +}