diff --git a/tests/auto/cplusplus/semantic/tst_semantic.cpp b/tests/auto/cplusplus/semantic/tst_semantic.cpp index 3df6573ccdac25302223d4816ecead66407f4300..bf113873fe4cf9c48f5d189833196ac6dd9203d6 100644 --- a/tests/auto/cplusplus/semantic/tst_semantic.cpp +++ b/tests/auto/cplusplus/semantic/tst_semantic.cpp @@ -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"