Title
reference_meows_from_temporary should not use is_meowible
Status
ready
Section
[meta.unary.prop]
Submitter
Tim Song

Created on 2022-11-08.00:00:00 last changed 3 weeks ago

Messages

Date: 2022-11-10.23:33:23

Proposed resolution:

This wording is relative to N4917.

[Drafting note: The note is already repeated every time we talk about "immediate context".]

  1. Modify [meta.type.synop], Table 46 ([tab:meta.unary.prop]) — "Type property predicates" — as indicated:

    Table 46: Type property predicates [tab:meta.unary.prop]
    Template Condition Preconditions
    template<class T, class U>
    struct reference_constructs_from_temporary;
    conjunction_v<is_reference<T>, is_constructible<T, U>> is trueT is a reference type, and the initialization T t(VAL<U>); is well-formed and binds t to a temporary object whose lifetime is extended ([class.temporary]). Access checking is performed as if in a context unrelated to T and U. Only the validity of the immediate context of the variable initialization is considered. [Note ?: The initialization can result in effects such as the instantiation of class template specializations and function template specializations, the generation of implicitly-defined functions, and so on. Such effects are not in the "immediate context" and can result in the program being ill-formed. — end note] T and U shall be complete types, cv void, or arrays of unknown bound.
    template<class T, class U>
    struct reference_converts_from_temporary;
    conjunction_v<is_reference<T>, is_convertible<U, T>> is trueT is a reference type, and the initialization T t = VAL<U>; is well-formed and binds t to a temporary object whose lifetime is extended ([class.temporary]). Access checking is performed as if in a context unrelated to T and U. Only the validity of the immediate context of the variable initialization is considered. [Note ?: The initialization can result in effects such as the instantiation of class template specializations and function template specializations, the generation of implicitly-defined functions, and so on. Such effects are not in the "immediate context" and can result in the program being ill-formed. — end note] T and U shall be complete types, cv void, or arrays of unknown bound.
Date: 2022-11-10.23:33:23

[ Kona 2022-11-08; Move to Tentatively Ready ]

Date: 2022-11-08.00:00:00

The intent of P2255R2 is for the reference_meows_from_temporary traits to fully support cases where a prvalue is used as the source. Unfortunately the wording fails to do so because it tries to use the is_meowible traits to say "the initialization is well-formed", but those traits only consider initialization from xvalues, not prvalues. For example, given:

struct U {
  U();
  U(U&&) = delete;
};

struct T {
  T(U);
};

reference_constructs_from_temporary_v<const T&, U> should be true, but is currently defined as false. We need to spell out the "is well-formed" condition directly.

History
Date User Action Args
2022-11-10 23:33:23adminsetmessages: + msg13012
2022-11-10 23:33:23adminsetstatus: new -> ready
2022-11-08 15:49:09adminsetmessages: + msg12956
2022-11-08 00:00:00admincreate