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.

4298. §[meta.reflection.extract] Malformed "F noexcept" type

Section: 21.4.12 [meta.reflection.extract] Status: New Submitter: Jan Schultke Opened: 2025-07-10 Last modified: 2025-07-26

Priority: Not Prioritized

View all issues with New status.

Discussion:

This is a follow-up from https://github.com/cplusplus/#8008

In 21.4.12 [meta.reflection.extract] paragraph 7, the type "F noexcept" is used, presumably with the intent that noexcept would be "injected" into the parameters-and-qualifiers of the declarator associated with F.

However, the syntax F noexcept is ill-formed, and does not have that intended effect. There ought to be a better way to phrase that.

Proposed resolution:

This wording is relative to this CD preview draft.

  1. Modify 21.4.12 [meta.reflection.extract] as indicated:

    [Drafting note: In bullet (7.1) we apply an additional drive-by fix for the broken "T is" construction before the is_convertible_v condition]

    template<class T>
      consteval T extract-member-or-function(info r); // exposition only
    

    -?- Given a function type F, let the type F with noexcept be the same type, except that the parameters-and-qualifiers in the noptr-declarator describing the type contain noexcept(true).

    -6- Returns: […]

    -7- Throws: meta::exception unless

    1. (7.1) — r represents a non-static data member with type X, that is not a bit-field, that is a direct member of class C, T and C are similar types (7.3.6 [conv.qual]), and T is is_convertible_v<X C::*, T> is true;

    2. (7.2) — r represents an implicit object member function with type F or F with noexcept that is a direct member of a class C, and T is F C::*; or

    3. (7.3) — r represents a non-member function, static member function, or explicit object member function of function type F or F with noexcept, and T is F*.