I was reading about one of the strange C++ feature called Injected class name here.
I tried following simple program
#include <iostream>
class test
{
    int s{3};
    public:
    int get_s()
    { return s; }
};
int main() {
    class test::test s;  // struct test::test s; also allowed. Why???
    std::cout<<s.get_s();
}
If I replace class keyword with struct in first line of main() program still compiles & runs fine. See live demo here. Why? Shouldn't I get compiler error? Why it compiles fine?
 
     
     
     
     
    