Skip to content

Commit bd2fc94

Browse files
committed
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)
1 parent bcc2d67 commit bd2fc94

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

generator/parser/parser.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ void Parser::tokenRequiredError(int token)
168168
err += token_name(token_stream.lookAhead());
169169
err += "''";
170170

171+
171172
reportError(err);
172173
}
173174

@@ -1922,7 +1923,7 @@ bool Parser::parseClassSpecifier(TypeSpecifierAST *&node)
19221923

19231924
NameAST *name = 0;
19241925
parseName(name, true);
1925-
1926+
19261927
BaseClauseAST *bases = 0;
19271928

19281929
if (token_stream.lookAhead() == ':')
@@ -3152,11 +3153,14 @@ bool Parser::parseDeclarationInternal(DeclarationAST *&node)
31523153
WinDeclSpecAST *winDeclSpec = 0;
31533154
parseWinDeclSpec(winDeclSpec);
31543155

3156+
const ListNode<std::size_t>* cv = 0;
3157+
parseCvQualify(cv);
3158+
31553159
const ListNode<std::size_t> *funSpec = 0;
31563160
bool hasFunSpec = parseFunctionSpecifier(funSpec);
31573161

3158-
const ListNode<std::size_t> *cv = 0;
3159-
parseCvQualify(cv);
3162+
if (!cv)
3163+
parseCvQualify(cv);
31603164

31613165
const ListNode<std::size_t> *storageSpec = 0;
31623166
bool hasStorageSpec = parseStorageClassSpecifier(storageSpec);

0 commit comments

Comments
 (0)