Visual C++ Compiler Error C2137

Message Text

empty character constant


As the message text states plainly enough, the empty character constant is illegal. Thus,

char ch = '';


int x = '';

both produce error C2137.

A curiosity, however, is that an empty wide-character constant causes the compiler no problem. In

wchar_t ch = L'';

(if the wchar_t type is defined, as by the /Zc:wchar_t option) and

int x = L''; 

the constant evaluates to zero and there is no error.