Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

C2589: 'false': illegal token on right side of '::'



  • Updating from 5.12 msvc 2017 to 5.15 msvc 2019 and I am getting C:\Qt\5.15.1\msvc2019_64\include\QtCore\qcborstreamreader.h:143: error: C2589: 'false': illegal token on right side of '::'

    It appears that in qcborcommon.h True and false is not defined so

    #if defined(False) && defined(True)
    define QT_X11_DEFINES_FOUND 1
    undef True
    undef False
    #endif
    
    

    isn't processed and thus in qcborstreamreader.h

    #if defined(QT_X11_DEFINES_FOUND)
    undef True
    undef False
    
    #endif
    

    isn't but True and False must now be ambiguous
    as a test I undefined them there and it works. So what am I missing because that isn't a valid solution


  • Moderators

    These ifdefs are for Linux (X11), not for Windows. Are you sure you don't define True or False somewhere in your code?

    I don't see this error reported anywhere on Qt bugtracker. If you are certain it is a bug in Qt, please report it.



  • QT_X11_DEFINES_FOUND should have been defined regardless of OS if True/False was defined, bad name in my opinion as it is not unique to X11. Also, bad practice was Qt using False/True in enum. However, it depends on the order they are included.
    After digging, as we don't have our 3rd party libs in the proj; I found in Live555 they have #define True


  • Moderators

    @JPSchmidt said in C2589: 'false': illegal token on right side of '::':

    QT_X11_DEFINES_FOUND should have been defined regardless of OS if True/False was defined, bad name in my opinion as it is not unique to X11.

    Definitely.

    Also, bad practice was Qt using False/True in enum.

    Indeed!



  • created
    https://bugreports.qt.io/browse/QTBUG-88591

    A forced includes hell order due to QT_X11_DEFINES_FOUND crossing header files


Log in to reply