From dc9e019a1deaecef56b0757daa9beb39c8001beb Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Mon, 26 Oct 2009 11:24:32 +0100 Subject: [PATCH] Test the enclosing scope of pointer-to-function symbols. --- .../auto/cplusplus/semantic/tst_semantic.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/auto/cplusplus/semantic/tst_semantic.cpp b/tests/auto/cplusplus/semantic/tst_semantic.cpp index 3df6573ccda..bf113873fe4 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" -- GitLab