Look at the following code:
int main(int argc, char* argv[])
{
// This works: (Disable Lang Ext = *Yes* (/Za))
wchar_t wc0 = L'\0';
wchar_t wc_ = L'';
assert(wc0 == wc_);
// This doesn't compile (VC++ 2010):
char c0 = '\0';
char c_ = ''; // error C2137: empty character constant
assert(c0 == c_);
return 0;
}
Why does the compiler allow defining an empty character literal for wide characters? This doesn't make sense for wide, just as it doesn't make sense for char
where the compiler flags an error.
Is this allowed by the Standard?