Commit 2d2ad82d by Martin v. Löwis

Add aliases in nested blocks

From-SVN: r21197
parent 2077e863
// Check namespace aliases inside blocks
namespace A { namespace A {
int i; int i;
void f(){} void f(){
i = 0;
}
} }
main () int g();
int main ()
{ {
namespace B = A; namespace B = A;
B::i=42; B::i=42;
B::f(); B::f();
using namespace B; using namespace B;
f(); 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment