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

Impact of new C++20 <version> on our code

    XMLWordPrintable

Details

    • Epic
    • Resolution: Fixed
    • P2: Important
    • 6.4.2, 6.5.0 FF
    • None
    • Core: Other
    • None
    • C++20 <version> @ Qt
    • 5
    • Foundation Sprint 69, Foundation Sprint 70
    • 83bf81fd7 (6.4)

    Description

      C++20 finally incorporated SD-6 feature test macros

      1. __cpp_xxx language macros (pre-defined)
      2. __cpp_lib_xxx library macros (#define'd in <version>

      That means Microsoft now needs to implement them, finally.

      We've been requiring them in the SD-6 form for all post-C++11 features (conscious policy decision to leave MSVC users out). No problem for language macros, as they're all pre-defined. Problem are the library macros:

      • __cpp_lib_optional only defined in <optional>
      • ok, so wrap #include <optional> in #if __has_include(<optional>)
      • but: <optional> #error's when #include'd in C++14 builds

      This particular issue is behind us, and we can hope that compiler vendors have learned the lesson to either not report back true on __has_include for newer-than-requested headers or else no longer #error out, but simply not declare anything.

      Nevertheless, the __has_include dance is very annoying, so <version> may end up being the first C++20 feature we require from all compilers.

      Availability:

      • libc++ ≥ LLVM 7 (what about AppleClang?)
      • libstd++ ≥ GCC 9 (what about QNX?)
      • MS STL ≥ main@ {2019-09-05}

        (what did this ship in?)

      • RougeWave (unknown, does anyone still ship that)
      • Dinkumware (unknown, does anyone still ship that)

      Depending on how far away we are on the various platforms, we may require a <version>, or we write a q20version.h.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-108228
          # Subject Branch Project Status CR V

          Activity

            People

              mmutz Marc Mutz
              mmutz Marc Mutz
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes