1124. Invalid definition of concept RvalueOf

Section: 99 [concept.transform] Status: NAD Concepts Submitter: Daniel Krügler Opened: 2009-05-28 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [concept.transform].

View all issues with NAD Concepts status.


A recent news group article points to several defects in the specification of reference-related concepts.

One problem of the concept RvalueOf as currently defined in 99 [concept.transform]:

concept RvalueOf<typename T> {
 typename type = T&&;
 requires ExplicitlyConvertible<T&,type> && Convertible<T&&,type>;

template<typename T> concept_map RvalueOf<T&> {
 typedef T&& type;

is that if T is an lvalue-reference, the requirement Convertible<T&&,type> isn't satisfied for lvalue-references, because after reference-collapsing in the concept definition we have Convertible<T&,type> in this case, which isn't satisfied in the concept map template and also is not the right constraint either. I think that the reporter is right that SameType requirements should do the job and that we also should use the new RvalueReference concept to specify a best matching type requirement.

Proposed resolution:

In 99 [concept.transform] before p. 4 change as indicated:

auto concept RvalueOf<typename T> {
  typenameRvalueReference type = T&&;
  requires ExplicitlyConvertible<T&, type> && Convertible<T&&, type>SameType<T&, type&>;