Add aliases in nested blocks

From-SVN: r21197
This commit is contained in:
Martin v. Löwis 1998-07-15 14:38:06 +00:00
parent 2077e863e2
commit 2d2ad82da4

View 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;
}