diff --git a/tests/auto/cplusplus/semantic/tst_semantic.cpp b/tests/auto/cplusplus/semantic/tst_semantic.cpp index 41d7a71d144542e9b95563cfde70a87ec804339b..2da819d5af7e97478584dbffd2831a2fbabca5d3 100644 --- a/tests/auto/cplusplus/semantic/tst_semantic.cpp +++ b/tests/auto/cplusplus/semantic/tst_semantic.cpp @@ -97,6 +97,7 @@ private slots: void nested_class_1(); void typedef_1(); void typedef_2(); + void typedef_3(); }; void tst_Semantic::function_declaration_1() @@ -295,5 +296,28 @@ void tst_Semantic::typedef_2() QVERIFY(mainFun); } +void tst_Semantic::typedef_3() +{ + QSharedPointer<Document> doc = document( +"typedef struct {\n" +" int x, y;\n" +"} *PointPtr;\n" + ); + + QCOMPARE(doc->errorCount, 0U); + QCOMPARE(doc->globals->symbolCount(), 2U); + + Class *_pointStruct= doc->globals->symbolAt(0)->asClass(); + QVERIFY(_pointStruct); + QCOMPARE(_pointStruct->memberCount(), 2U); + + Declaration *typedefPointDecl = doc->globals->symbolAt(1)->asDeclaration(); + QVERIFY(typedefPointDecl); + QVERIFY(typedefPointDecl->isTypedef()); + QVERIFY(typedefPointDecl->type()->isPointerType()); + QCOMPARE(typedefPointDecl->type()->asPointerType()->elementType()->asClass(), + _pointStruct); +} + QTEST_APPLESS_MAIN(tst_Semantic) #include "tst_semantic.moc"