1 #include "ns.h" 2 extern int func(); 3 4 // Note: the following function must be before the using. 5 void test_lookup_before_using_directive() 6 { 7 // BP_before_using_directive 8 std::printf("before using directive: func() = %d\n", func()); // eval func(), exp: 1 9 } 10 using namespace A; 11 void test_lookup_after_using_directive() 12 { 13 // BP_after_using_directive 14 //printf("func() = %d\n", func()); // eval func(), exp: error, ambiguous 15 std::printf("after using directive: func2() = %d\n", func2()); // eval func2(), exp: 3 16 std::printf("after using directive: ::func() = %d\n", ::func()); // eval ::func(), exp: 1 17 std::printf("after using directive: B::func() = %d\n", B::func()); // eval B::func(), exp: 4 18 } 19