[Development] Two source incompatibilities in Qt 5.5 with Clang

Stephen Kelly steveire at gmail.com
Thu Mar 5 13:59:01 CET 2015


After commit ebef2ad1 (Make the empty Q_ASSERT still check its
argument for validity, 2014-09-11), there are two source
incompatibilities compared to Qt 5.4. I understand the message in the

The following code fails to compile with -DQT_NO_DEBUG:

sic.cpp:10:14: error: use of undeclared identifier 'checkInvariant'



qglobal.h:663:52: note: expanded from macro 'Q_ASSERT'

#    define Q_ASSERT(cond) do { } while (false && (cond))


1 error generated.

$ cat sic.cpp

#include <QtCore/QObject>

#ifndef QT_NO_DEBUG

static bool checkInvariant() { return true; }


void foo()




If compiled with ccache, there is a second problem if used with

sic.cpp:10:29: error: code will never be executed [-Werror,-Wunreachable-code]

    do { } while (false && (checkInvariant()));


sic.cpp:10:19: note: silence by adding parentheses to mark code as
explicitly dead

    do { } while (false && (checkInvariant()));


                  /* DISABLES CODE */ ( )

1 error generated.

In this case, adding

 run_second_cpp = true



makes it compile without changing the macro.

If we want this source compatibility, both of these issues should be
mentioned in the release notes.



More information about the Development mailing list