On 2/10/2014 5:29 AM, Adi Shavit wrote:
Hi,
On VS2010, the following code does not compile if I restore the commented out#include:
*// #include
* struct X { enum Labels { ERROR, ONE, TWO, THREE }; // problem => ^^^^^ };
void f() { X::Labels r = X::ERROR; // problem => ^^^^^ }
The VS2010 errors are:
t.cpp(5): error C2059: syntax error : 'constant' t.cpp(5): error C2143: syntax error : missing ';' before '}' t.cpp(5): error C2238: unexpected token(s) preceding ';' t.cpp(7): error C2059: syntax error : '}' t.cpp(7): error C2143: syntax error : missing ';' before '}' t.cpp(7): error C2059: syntax error : '}' t.cpp(11): error C2589: 'constant' : illegal token on right side of '::' t.cpp(11): error C2059: syntax error : '::'
It seems that somewhere inside the #include hierarchy the symbol ERROR is #defined to cause this code to fail. Renaming ERROR to something else avoids this problem.
I do not know where ERROR is occuring. But it is certainly not a good idea to have an enumeration name be a common all-uppercase name.
I think I tracked it into 'boost/spirit/home/classic/iterator/impl/file_iterator.ipp' but I'm not sure where exactly it is coming from.