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

Add a macro for C++20 constexpr

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • P2: Important
    • None
    • 6.8
    • Core: Other
    • None
    • 21
    • 3ab18f402 (dev), 8fa8c574c (dev)
    • Foundation Sprint 105, Foundation Sprint 106, Foundation Sprint 107, Foundation Sprint 108, Foundation Sprint 109, Foundation Sprint 110, Foundation Sprint 111, Foundation Sprint 112, Foundation Sprint 113, Foundation Sprint 114, Foundation Sprint 115, Foundation Sprint 116

    Description

      Update: For now, there is only one single use of this macro: explicit destructors can be constexpr. There may be more once we increase our usage of C++20. Therefore, there is no need to add it now. Instead we are adding Q_DECL_CONSTEXPR_DTOR.

      _____________________________________________________________________________________

      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 explicit 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

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: