Skip to content
Snippets Groups Projects
Commit dc9e019a authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Test the enclosing scope of pointer-to-function symbols.

parent f4047ac8
No related branches found
No related tags found
No related merge requests found
......@@ -100,6 +100,7 @@ private slots:
void typedef_3();
void const_1();
void const_2();
void pointer_to_function_1();
};
void tst_Semantic::function_declaration_1()
......@@ -367,5 +368,24 @@ void tst_Semantic::const_2()
QVERIFY(arg->type()->asPointerType()->elementType()->isIntegerType());
}
void tst_Semantic::pointer_to_function_1()
{
QSharedPointer<Document> doc = document("void (*QtSomething)();");
QCOMPARE(doc->errorCount, 0U);
QCOMPARE(doc->globals->symbolCount(), 1U);
Declaration *decl = doc->globals->symbolAt(0)->asDeclaration();
QVERIFY(decl);
PointerType *ptrTy = decl->type()->asPointerType();
QVERIFY(ptrTy);
Function *funTy = ptrTy->elementType()->asFunctionType();
QVERIFY(funTy);
QVERIFY(funTy->scope());
QCOMPARE(funTy->scope(), decl->scope());
}
QTEST_APPLESS_MAIN(tst_Semantic)
#include "tst_semantic.moc"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment