Question about [expr.cond]/(4.3)

27 views
Skip to first unread message

S. B. Tam

unread,
Aug 16, 2016, 1:23:30 PM8/16/16
to ISO C++ Standard - Discussion
N4606 [expr.cond]/(4.3) reads:

— (4.3) If E2 is a prvalue or if neither of the conversion sequences above can be formed and at least one of the
operands has (possibly cv-qualified) class type:
— (4.3.1) if T1 and T2 are the same class type (ignoring cv-qualification), or one is a base class of the other,
and T2 is at least as cv-qualified as T1, the target type is T2,
— (4.3.2) otherwise, the target type is the type that E2 would have after applying the lvalue-to-rvalue (4.1),
array-to-pointer (4.2), and function-to-pointer (4.3) standard conversions.

It seems that to satisfy the condition in (4.3.1), T2 must be a class type, in which case T2 is the same as the type that E2 would have after applying the lvalue-to-rvalue, array-to-pointer, and function-to-pointer standard conversions (since lvalue-to-rvalue conversion does not alter the type, and array-to-pointer and function-to-pointer conversions do not apply to class types). So, could (4.3) be simplified to:

— (4.3) If E2 is a prvalue or if neither of the conversion sequences above can be formed and at least one of the
operands has (possibly cv-qualified) class type, the target type is the type that E2 would have after applying the
lvalue-to-rvalue (4.1), array-to-pointer (4.2), and function-to-pointer (4.3) standard conversions.

?

Richard Smith

unread,
Aug 16, 2016, 2:16:35 PM8/16/16
to std-dis...@isocpp.org
Yes, I agree; it looks like this simplification was overlooked when we were working on CWG1895.


--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+unsubscribe@isocpp.org.
To post to this group, send email to std-dis...@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.

Reply all
Reply to author
Forward
0 new messages