forked from qt-creator/qt-creator
CPlusPlus: Fix crash on weird-looking construct
This was misparsed as a function with an initializer (e.g. "= default"), and then the empty id caused trouble later on. Fixes: QTCREATORBUG-29386 Change-Id: I85a35db544e11ad85f50e3a15b1a071b36e79cd0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -190,6 +190,7 @@ private slots:
|
||||
void enumDeclaration();
|
||||
void invalidEnumClassDeclaration();
|
||||
void invalidEnumWithDestructorId();
|
||||
void invalidFunctionInitializer();
|
||||
};
|
||||
|
||||
void tst_AST::gcc_attributes_1()
|
||||
@@ -2052,6 +2053,14 @@ void tst_AST::invalidEnumWithDestructorId()
|
||||
QVERIFY(diag.errorCount != 0);
|
||||
}
|
||||
|
||||
void tst_AST::invalidFunctionInitializer()
|
||||
{
|
||||
QSharedPointer<TranslationUnit> unit(parse(
|
||||
"int main() { a t=b; c d(e)=\"\"; }", TranslationUnit::ParseTranlationUnit, false, false, true));
|
||||
|
||||
QVERIFY(diag.errorCount != 0);
|
||||
}
|
||||
|
||||
void tst_AST::initTestCase()
|
||||
{
|
||||
control.setDiagnosticClient(&diag);
|
||||
|
||||
Reference in New Issue
Block a user