Can someone explain the behavior I am seeing for namespace search for qualified names in the following example code? See inline comments for the issue.
namespace ns1::hw
{
struct A1
{
enum class E1
{
E1_1,
E1_2,
};
};
};
namespace ns1::ns2::hw
{
struct A2
{
enum class E1
{
E1_1,
E1_2,
};
};
};
namespace ns1::ns2::ns3::hw
{
struct A3
{
enum class E1
{
E1_1,
E1_2,
};
};
};
namespace ns1::ns2::ns3::ns4
{
struct A4
{
int I1 { (int)hw::A3::E1::E1_1 }; // <--- this compiles OK
// seems to search upwards in the parent namespace,
// looking for the relative partially qualified
// name.
int I2 { (int)hw::A2::E1::E1_1 }; // <--- this doesn't
// doesn't seem to apply the same search algorithm
// beyond the immediate parent namespace.
};
};
int main()
{
return 0;
}