template<int N>
struct S
{
void foo()
{
sizeof( S ); // (*)
sizeof( S<N> );
}
};
int main()
{
S<5> s;
s.foo();
return 0;
}
This code compiles fine (VS2010), but i have doubts about (*)
string. S
is not complete type, unlike S<N>
in my opinion then how come the compiler knows its size? What does the standard say about such situation, does it well-formed correct sizeof
?