I accidentally noticed that you can pointlessly use :: operator to reefer back to the original struct/class again, for example:
#include <iostream>
struct Test
{
static const int x = 5;
};
int main()
{
std::cout << Test::x; // makes sense
std::cout << Test::Test::x; // still works?
std::cout << Test::Test::Test::x; // okay...
return 0;
}
This can be stacked more and more. However, you can't construct an object this way, because compiler doesn't recognize it as a type, but interprets it as a class::constructor.
Test::Test Obj; // error, not a type
Although if there was a nested class inside, then you could still reference it this way and successfully construct an object.
I was wondering what leads to this, is this a side effect of something else? It seems totally useless but made me curious.