19 lines · cpp
1#include "ns.h"2extern int func();3 4// Note: the following function must be before the using.5void test_lookup_before_using_directive()6{7 // BP_before_using_directive8 std::printf("before using directive: func() = %d\n", func()); // eval func(), exp: 19}10using namespace A;11void test_lookup_after_using_directive()12{13 // BP_after_using_directive14 //printf("func() = %d\n", func()); // eval func(), exp: error, ambiguous15 std::printf("after using directive: func2() = %d\n", func2()); // eval func2(), exp: 316 std::printf("after using directive: ::func() = %d\n", ::func()); // eval ::func(), exp: 117 std::printf("after using directive: B::func() = %d\n", B::func()); // eval B::func(), exp: 418}19