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

Impact of C++20 consteval on our code

XMLWordPrintable

    • Icon: Epic Epic
    • Resolution: Unresolved
    • Icon: P4: Low P4: Low
    • None
    • None
    • Core: Other
    • None
    • C++20 consteval @ Qt

      TL;DR: uninteresting until we depend on C++20

      C++20 added the consteval keyword, which marks up functions that can only be executed at compile time (https://en.cppreference.com/w/cpp/language/consteval). Note that the related if consteval (https://en.cppreference.com/w/cpp/language/if#Consteval_if) is not C++20, but C++23.

      Until we can depend on C++20, all we could do is to hide the keyword behind a macro that falls back to the closest approximation in C++17, which is constexpr. But constexpr functions can also be called at runtime, while consteval ones can not, so we'd allow code to compile in C++17 that wouldn't compile in C++20. That's not useful, so we can't use consteval until all compilers support it.

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

            cnn Qt Core & Network
            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:

                There is 1 open Gerrit change