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

Impact of C++20 consteval on our code

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

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

          Activity

            People

              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

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes