Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-25817

Enabling C++11 with clang causes constexpr errors

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • None
    • 5.0.0 Beta 1, 5.0.0
    • Other
    • None
    • OS X 10.7.4, MacPorts clang version 3.1 (branches/release_31 155781), Qt 5 from git

    Description

      Enable C+11 with -std=c+0x using clang 3.1 causes the following errors:

      14:25:37: Running steps for project cxx11...
      14:25:37: Configuration unchanged, skipping qmake step.
      14:25:37: Starting: "/usr/bin/make" -w
      make: Entering directory `/Users/stephenchu/Dropbox/cxx11'
      /Qt/5.0/qtbase/bin/qmake -spec /Qt/5.0/qtbase/mkspecs/macx-clang CONFIG+=x86_64 -o Makefile cxx11.pro
      make: Leaving directory `/Users/stephenchu/Dropbox/cxx11'
      make: Entering directory `/Users/stephenchu/Dropbox/cxx11'
      clang++ -c -pipe -mmacosx-version-min=10.6 -std=c++0x -stdlib=libc++ -g -gdwarf-2 -Wall -W -fPIE -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/Qt/5.0/qtbase/mkspecs/macx-clang -I. -I/Qt/5.0/qtbase/include/QtCore -I/Qt/5.0/qtbase/include/QtGui -I/Qt/5.0/qtbase/include -I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/System/Library/Frameworks/AGL.framework/Headers -I. -F/Qt/5.0/qtbase/lib -o main.o main.cpp
      In file included from main.cpp:1:
      In file included from /Qt/5.0/qtbase/include/QtCore/QtCore:4:
      In file included from /Qt/5.0/qtbase/include/QtCore/qabstractanimation.h:1:
      In file included from /Qt/5.0/qtbase/include/QtCore/../../src/corelib/animation/qabstractanimation.h:45:
      In file included from /Qt/5.0/qtbase/include/QtCore/qobject.h:1:
      In file included from /Qt/5.0/qtbase/include/QtCore/../../src/corelib/kernel/qobject.h:48:
      In file included from /Qt/5.0/qtbase/include/QtCore/qstring.h:1:
      In file included from /Qt/5.0/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:46:
      In file included from /Qt/5.0/qtbase/include/QtCore/qbytearray.h:1:
      /Qt/5.0/qtbase/include/QtCore/../../src/corelib/tools/qbytearray.h:393:29: error: constexpr constructor never produces a constant expression [-Winvalid-constexpr]
          Q_DECL_CONSTEXPR inline QByteArray(QByteArrayDataPtr dd)
                                  ^
      /Qt/5.0/qtbase/include/QtCore/../../src/corelib/tools/qbytearray.h:394:13: note: reinterpret_cast is not allowed in a constant expression
              : d(reinterpret_cast<Data *>(dd.ptr))
                  ^
      In file included from main.cpp:1:
      In file included from /Qt/5.0/qtbase/include/QtCore/QtCore:43:
      In file included from /Qt/5.0/qtbase/include/QtCore/qurl.h:1:
      /Qt/5.0/qtbase/include/QtCore/../../src/corelib/io/qurl.h:70:48: error: constexpr constructor's 1st parameter type 'QFlag' is not a literal type
          Q_DECL_CONSTEXPR inline QUrlTwoFlags(QFlag f) : i(f) {}
                                               ~~~~~~^
      /Qt/5.0/qtbase/include/QtCore/../../src/corelib/global/qflags.h:51:7: note: 'QFlag' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors
      class QFlag
            ^
      main.cpp:121:40: warning: unused parameter 'v' [-Wunused-parameter]
              re.addRule(new RuleFunc([](QVariant & v) { return true; } ), {} );
                                                    ^
      1 warning and 2 errors generated.
      make: *** [main.o] Error 1
      make: Leaving directory `/Users/stephenchu/Dropbox/cxx11'
      14:25:40: The process "/usr/bin/make" exited with code 2.
      Error while building/deploying project cxx11 (target: Desktop)
      When executing step 'Make'
      

      The same errors occurs when trying to build Qt 5 with clang 3.1.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sorvig Morten Sørvig
            stephenju Stephen Chu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes