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

4468. §[const.wrap.class] "operator decltype(auto)" is ill-formed

Section: 21.3.5 [const.wrap.class] Status: New Submitter: Jiang An Opened: 2025-11-07 Last modified: 2025-11-10

Priority: Not Prioritized

View other active issues in [const.wrap.class].

View all other issues in [const.wrap.class].

View all issues with New status.

Discussion:

Following the approval of CWG 1670 in Kona 2025, the following declaration in class template constant_wrapper, 21.3.5 [const.wrap.class], is ill-formed:

constexpr operator decltype(auto)() const noexcept { return value; }

Proposed resolution:

This wording is relative to N5014.

  1. Modify 21.3.5 [const.wrap.class], class template constant_wrappersynopsis, as indicated:

    […]
    template<cw-fixed-value X, class>
    struct constant_wrapper : cw-operators {
      static constexpr const auto & value = X.data;
    
      using type = constant_wrapper;
      using value_type = typename decltype(X)::type;
    
      […]
      constexpr operator decltype(autovalue)() const noexcept { return value; }
    };