Is this well defined behaviour or is it undefined / somehow else defined which foo (data type or identifier) sizeof will be operating on ?
foo
sizeof
The local char foo completely hides typedef int foo in its scope. You cannot observe the name foo once it is hidden. Try creating a second typedef foo foo_t, or renaming something to avoid the "collision."
char foo
typedef int foo
typedef foo foo_t