Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enum class: does not name a value error

I have

enum class ErrorLevel
    {
        VERBOSE,
        DEBUG_,
        INFORMATION,
        WARNING,
        ERROR
    };

This works:

assertDetectionParameters( parameterSet, ErrorLevel::WARNING );

This does not:

assertDetectionParameters( parameterSet, ErrorLevel::ERROR );

Error 1 error C2589: 'constant' : illegal token on right side of '::'
Error 2 error C2059: syntax error : '::'

Resharper says:

"ErrorLevel does not name a value"

I get this error for certain names in my enum.

like image 426
tmanthey Avatar asked Oct 31 '22 02:10

tmanthey


1 Answers

ERROR is probably already a preprocessor macro somewhere. Try changing it to something else, e.g. ERROR_, in order to test this hypothesis. Alternatively run your code through the preprocessor to see what substitutions are being made (gcc -E ... or whatever the equivalent is in Visual Studio).

like image 173
Paul R Avatar answered Nov 15 '22 03:11

Paul R