https://eel.is/c++draft/meta.trans.other
The definition of COMMON-REF concludes with, "If any of the types
computed above is ill-formed, then COMMON-REF(A, B) is ill-formed."
I'm not sure what this means. My first inclination is that it means, if
the type formed for the particular case is ill-formed, then
COMMON-REF(A, B) is ill-formed. But this seems redundant with the
immediately preceding statement, "Otherwise, COMMON-REF(A, B) is
ill-formed."
The other interpretation is that if the type of any of the four cases is
ill-formed, then COMMON-REF(A, B) is ill-formed even if a different case
applies. But it seems odd to me to say that, if X is A& and Y is B&,
that COMMON-REF(X, Y) is ill-formed if the type for the mixed rvalue and
lvalue reference case, namely, COMMON-REF(const A&, B&), is ill-formed.
Can anyone shed some light on this?
Given types
AandB, letXberemove_reference_t<A>, letYberemove_reference_t<B>, and letCOMMON_REF(A,B)be:(3.1) – If
AandBare both lvalue reference types,COMMON_REF(A,B)isCOND_RES(COPYCV(X,Y) &, COPYCV(Y,X) &).
(3.2) – IfAandBare both rvalue reference types, andCOMMON_RES(X&,Y&)is well formed, andis_convertible<A,R>::valueandis_convertible<B,R>::valueare true whereRisremove_reference_t<COMMON_RES(X&,Y&)>&&ifCOMMON_RES(X&,Y&)is a reference type orCOMMON_RES(X&,Y&)otherwise, thenCOMMON_RES(A,B)isR.
(3.3) – IfAis an rvalue reference andBis an lvalue reference andCOMMON_REF(const X&, Y&)is well formed andis_convertible<A,R>::valueis true whereRisCOMMON_REF(const X&, Y&)thenCOMMON_RES(A,B)isR.
(3.4) – IfAis an lvalue reference andBis an rvalue reference, thenCOMMON_REF(A,B)isCOMMON_REF(B,A).
(3.5) – Otherwise,COMMON_REF(A,B)isdecay_t<COND_RES(CREF(A),CREF(B))>.If any of the types computed above are ill-formed, then
COMMON_REF(A,B)is ill-formed.