forked from qt-creator/qt-creator
Test the enclosing scope of pointer-to-function symbols.
This commit is contained in:
@@ -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"
|
||||
|
Reference in New Issue
Block a user