This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.

3303. Bad "constexpr" marker for destroy/destroy_n

Section: 20.10.2 [memory.syn] Status: WP Submitter: Jens Maurer Opened: 2019-10-10 Last modified: 2020-09-06

Priority: 0

View all issues with WP status.

Discussion:

This issue was submitted as editorial issue cplusplus/draft#3181 but is considered non-editorial.

P0784R7, approved in Cologne, added "constexpr" markers to the overloads of destroy and destroy_n taking an ExecutionPolicy parameter. This seems to be in error; parallel algorithms should not be marked "constexpr". (None of the parallel algorithms in <algorithm> is marked "constexpr".)

[2019-11 Marked as 'Ready' during Monday issue prioritization in Belfast]

Proposed resolution:

This wording is relative to N4830.

  1. Modify 20.10.2 [memory.syn], header <memory> synopsis, as indicated:

    namespace std {
      […]
      
      // 25.11.8 [specialized.destroy], destroy
      template<class T>
        constexpr void destroy_at(T* location);
      template<class ForwardIterator>
        constexpr void destroy(ForwardIterator first, ForwardIterator last);
      template<class ExecutionPolicy, class ForwardIterator>
        constexpr void destroy(ExecutionPolicy&& exec, // see 25.3.5 [algorithms.parallel.overloads]
                               ForwardIterator first, ForwardIterator last);
      template<class ForwardIterator, class Size>
        constexpr ForwardIterator destroy_n(ForwardIterator first, Size n);
      template<class ExecutionPolicy, class ForwardIterator, class Size>
        constexpr ForwardIterator destroy_n(ExecutionPolicy&& exec, // see 25.3.5 [algorithms.parallel.overloads]
                                            ForwardIterator first, Size n);  
      […]
    }