build error in kdelibs - QTest related

Ingo Klöcker kloecker at kde.org
Mon Dec 7 22:08:28 GMT 2009


On Monday 07 December 2009, Alexander Neundorf wrote:
> Hi,
>
> kdelibs currently does not build on Solaris with the Sun Studio
> compiler if the tests are enabled:
> http://my.cdash.org/viewBuildError.php?buildid=40434
>
> This is the error:
> [ 31%] Building CXX object
> kdecore/tests/CMakeFiles/kjobtest.dir/kjobtest.o
>
> "/.../srcdir/kdecore/tests/kjobtest.cpp", line 96: Error: Could not
> find a match for QTest::qCompare<QTest::T>(KJob*, TestJob*, const
> char[45], const char[4], const char[65], int) needed in
> KJobTest::testProgressTracking().
>
>
> Any idea what's wrong here ?

Excerpt of http://doc.trolltech.com/4.5/qtest.html#QCOMPARE:
QCOMPARE is very strict on the data types. Both actual and expected have 
to be of the same type, otherwise the test won't compile. This 
prohibits unspecified behavior from being introduced; that is behavior 
that usually occurs when the compiler implicitly casts the argument.

Apparently, the Sun Studio compiler is stricter than gcc and does not 
cast TestJob* to KJob*, but regards them as different (which they are).

Changing
QCOMPARE( processed_spy.at( 0 ).at( 0 ).value<KJob*>(), job );
to
QCOMPARE( processed_spy.at( 0 ).at( 0 ).value<KJob*>(), 
static_cast<KJob*>( job ) );
should help.


Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20091207/f6208532/attachment.sig>


More information about the kde-core-devel mailing list