diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-12-11 15:13:00 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-12-11 15:19:44 (GMT) |
commit | 454e87a57b6876b8db2180236082d7c7bc408a0e (patch) | |
tree | 4b42f1ad0adaf510310b77c9819d9d863e258305 | |
parent | 1908e12284e1f6f25bfb46df3ce9659c6e19a50c (diff) | |
download | Qt-454e87a57b6876b8db2180236082d7c7bc408a0e.zip Qt-454e87a57b6876b8db2180236082d7c7bc408a0e.tar.gz Qt-454e87a57b6876b8db2180236082d7c7bc408a0e.tar.bz2 |
Fix normalization of Type * const
After commit b881d8fb99972f1bd04ab4c84843cc8d43ddbeed, we would no
longer append "const" when seeing it after a *. This commit fixes the
regression.
Reviewed-by: ogoffart
-rw-r--r-- | src/corelib/kernel/qmetaobject_p.h | 3 | ||||
-rw-r--r-- | tests/auto/qmetaobject/tst_qmetaobject.cpp | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index 7afb70b..83ca9af 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -295,6 +295,9 @@ static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixSc } else if (!star) { // move const to the front (but not if const comes after a *) result.prepend("const "); + } else { + // keep const after a * + result += "const"; } } } diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index 8331ca1..fb62312 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -664,7 +664,7 @@ void tst_QMetaObject::normalizedSignature_data() QTest::newRow("const rettype") << "const QString *foo()" << "const QString*foo()"; QTest::newRow("const ref") << "const QString &foo()" << "const QString&foo()"; QTest::newRow("reference") << "QString &foo()" << "QString&foo()"; - QTest::newRow("const2") << "void foo(QString const *)" << "void foo(const QString*)"; + QTest::newRow("const1") << "void foo(QString const *)" << "void foo(const QString*)"; QTest::newRow("const2") << "void foo(QString * const)" << "void foo(QString*const)"; QTest::newRow("const3") << "void foo(QString const &)" << "void foo(QString)"; QTest::newRow("const4") << "void foo(const int)" << "void foo(int)"; @@ -672,7 +672,7 @@ void tst_QMetaObject::normalizedSignature_data() << "void foo(int,int,int,int)"; QTest::newRow("const6") << "void foo(QList<const int>)" << "void foo(QList<const int>)"; QTest::newRow("const7") << "void foo(QList<const int*>)" << "void foo(QList<const int*>)"; - QTest::newRow("const7") << "void foo(QList<int const*>)" << "void foo(QList<const int*>)"; + QTest::newRow("const8") << "void foo(QList<int const*>)" << "void foo(QList<const int*>)"; } void tst_QMetaObject::normalizedSignature() |