#include "ns.h"
static int func()
{
std::printf("static m2.cpp func()\n");
return 2;
}
void test_lookup_at_file_scope()
{
std::printf("at file scope: func() = %d\n", func());
std::printf("at file scope: func(10) = %d\n", func(10));
}
namespace A {
namespace B {
int func()
{
std::printf("A::B::func()\n");
return 4;
}
void test_lookup_at_nested_ns_scope()
{
std::printf("at nested ns scope: func() = %d\n", func());
}
void test_lookup_at_nested_ns_scope_after_using()
{
using A::func;
std::printf("at nested ns scope after using: func() = %d\n", func());
}
}
}
int A::foo()
{
std::printf("A::foo()\n");
return 42;
}
int A::func(int a)
{
std::printf("A::func(int)\n");
return a + 3;
}
void A::test_lookup_at_ns_scope()
{
std::printf("at nested ns scope: func() = %d\n", func());
std::printf("at nested ns scope: func(10) = %d\n", func(10));
std::printf("at nested ns scope: foo() = %d\n", foo());
}