forked from qt-creator/qt-creator
C++: Fix parsing enum specifier
The enum name has to be an identifier. For the example in the referenced report it was a destructor, which violated invariants in the lookup code. Fixes: QTCREATORBUG-20952 Change-Id: Ib8c9c23d6e001368c11c6a4b80c4295559786823 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
6
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
6
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -1834,7 +1834,11 @@ bool Parser::parseEnumSpecifier(SpecifierListAST *&node)
|
||||
error(cursor(), "expected identifier before '%s'", tok().spell());
|
||||
return false;
|
||||
}
|
||||
parseName(ast->name);
|
||||
|
||||
if (LA() == T_IDENTIFIER)
|
||||
parseName(ast->name);
|
||||
else
|
||||
return false;
|
||||
|
||||
if (_languageFeatures.cxx11Enabled && LA() == T_COLON) {
|
||||
ast->colon_token = consumeToken();
|
||||
|
Reference in New Issue
Block a user