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

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

XMLWordPrintable

    • Icon: Epic Epic
    • Resolution: Fixed
    • Icon: P2: Important 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), 4771dc308 (dev), 2a5d850e4 (6.9), f36cf92db (6.8), f1cf87ed3 (tqtc/lts-6.5)

      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.

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

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

              Created:
              Updated:
              Resolved: