From 7acd49dae9925aaaf25e729f8fbca0d1034b09ff Mon Sep 17 00:00:00 2001 From: mrbean-bremen Date: Fri, 27 Oct 2023 16:06:01 +0200 Subject: [PATCH] Fix parse error for function declaration - cv qualifiers before inline etc. have been incorrectly parsed, leading to several follow-up errors (about 20000 parse errors in Qt6) --- generator/parser/parser.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/generator/parser/parser.cpp b/generator/parser/parser.cpp index 3a8102510..79736ba8d 100644 --- a/generator/parser/parser.cpp +++ b/generator/parser/parser.cpp @@ -168,6 +168,7 @@ void Parser::tokenRequiredError(int token) err += token_name(token_stream.lookAhead()); err += "''"; + reportError(err); } @@ -1914,7 +1915,7 @@ bool Parser::parseClassSpecifier(TypeSpecifierAST *&node) NameAST *name = 0; parseName(name, true); - + BaseClauseAST *bases = 0; if (token_stream.lookAhead() == ':') @@ -3144,11 +3145,14 @@ bool Parser::parseDeclarationInternal(DeclarationAST *&node) WinDeclSpecAST *winDeclSpec = 0; parseWinDeclSpec(winDeclSpec); + const ListNode* cv = 0; + parseCvQualify(cv); + const ListNode *funSpec = 0; bool hasFunSpec = parseFunctionSpecifier(funSpec); - const ListNode *cv = 0; - parseCvQualify(cv); + if (!cv) + parseCvQualify(cv); const ListNode *storageSpec = 0; bool hasStorageSpec = parseStorageClassSpecifier(storageSpec);