Error while compiling Qt 5.0.2: incorrect "constexpr"-ness of qMax() overload on timeval arguments



  • Hi all,

    While compiling Qt from the 5.0.2 tarball, I get the following error:

    kernel/qtimerinfo_unix.cpp:98:30: error: redeclaration ‘constexpr T qAbs(const T&) [with T = timeval]’ differs in ‘constexpr’
    timeval qAbs(const timeval &t)
    ^
    In file included from ../../include/QtCore/qglobal.h:1:0,
    from global/qt_pch.h:58:
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483:27: error: from previous declaration ‘constexpr T qAbs(const T&) [with T = timeval]’
    Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
    ^
    kernel/qtimerinfo_unix.cpp: In function ‘constexpr T qAbs(const T&) [with T = timeval]’:
    kernel/qtimerinfo_unix.cpp:109:1: error: body of constexpr function ‘constexpr T qAbs(const T&) [with T = timeval]’ not a return-statement

    (............. plus a lot more ...............)

    Investigating the issue does indeed show a template specialization on qMax<timeval> that does not have the "constexpr" attribute, while the generic qMax<T> does.

    I am using g++ 4.8.2 on Debian/testing.

    Is there any easy way I can fix this? I already tried to remove the constexpr declaration on qMax<T> but the problem cascades to functions that use that.

    Any help is appreciated.

    Sidney


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.