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

clang is not considered as a C++11 compiler

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Invalid
    • Affects Version/s: 5.7.1
    • Fix Version/s: None
    • Component/s: Build System
    • Labels:
      None

      Description

      By default, clang states it support only C++98 (even clang 5.0)

      $ clang++ -dM -E -x c++ /dev/null|grep plusplus
      #define __cplusplus 199711L

      Clang actually supports more as stated here:

      https://clang.llvm.org/cxx_status.html#cxx11

      To get the proper define, -std=c++11 should be used

       

      $ clang++ -std=c+11 -dM -E -x c+ /dev/null|grep cplusplus
      #define __cplusplus 201103L

       

      A solution could be to change the list https://github.com/qt/qtbase/blob/be93d2de031fb870a1ff244304311e07536a13b9/src/corelib/global/qcompilerdetection.h#L566

      by

      #  if __cplusplus < 201103L && !(defined(Q_CC_MSVC) && Q_CC_MSVC >= 1800) && !(defined(Q_CC_CLANG) && Q_CC_CLANG >= 303)

      but this will still fails on features like atomic

      if __has_feature(cxx_atomic) && __has_include(<atomic>)

      as this isn't explicitly enable in clang by default.

      This is a regression from patch dd59118b87d779e5cbfcd0b4ee2a3d5332433da9

       

        Attachments

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

          Activity

            People

            • Assignee:
              buddenha Oswald Buddenhagen
              Reporter:
              sylvestre Sylvestre Ledru
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes