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

Add a macro for C++20 constexpr

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8
    • Core: Other
    • None
    • 3
    • Foundation Sprint 105, Foundation Sprint 106, Foundation Sprint 107

    Description

      For now, there is only a single use of this macro. So there is no need to add it now. There may be more uses once we begin making more use of C++20. 

      Some changes and enhancements were made to the constexpr feature in C++20 making it more flexible.  For example: It allows now dynamic memory allocation and deallocation, constexpr destructors, ect.  https://en.cppreference.com/w/cpp/language/constexpr#:~:text=Constexpr%20lambda-,201907L,-(C%2B%2B20)}}

      Create a macro for C++20 constexpr instead of writing multiple times:

      #if __cpp_constexpr >= 201907L

          constexpr

      #endif 

      I suggest a simple macro CONSTEXPR_20 in qcompilerdetection.h:

      #if __cpp_constexpr >= 201907L

          define CONSTEXPR_20     constexpr
      #else

         define CONSTEXPR_20
      #endif

       

       

      Attachments

        Issue Links

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

          Activity

            People

              rybouabi Rym Bouabid
              rybouabi Rym Bouabid
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change