I am watching the following video
It is mentioned here that g++ will report an error for the following code:
#include<vector>
#include<typeinfo>
#include<iostream>
struct S
{
std::vector<std::string> b ;
};
int main()
{
S s;
std::cout << typeid(S::b).name();
}
error: invalid use of non-static data member ‘S::b’
But I did not encounter this kind of error under msvc and clang. Who is right and why? And why is it changed to
typeid(&S::b).name();
Is the result correct afterwards?