This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-19
[Accepted as a DR at the June, 2024 meeting.]
Consider:
#include <concepts> template <class T> T get(); template <class T> using X = decltype(true ? get<T const&>() : get<T>()); struct C { }; static_assert(std::same_as<X<int>, int>); static_assert(std::same_as<X<C>, C const>); // #1
Before Issue 1895, #1 was well-formed. With the reformulation based on conversion sequences, #1 is now ill-formed because both conversion sequences can be formed.
Proposed resolution (approved by CWG 2024-05-03):
Change in 7.6.16 [expr.cond] bullet 4.3 as follows:
- ...
- 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:
- if T1 and T2 are the same class type (ignoring cv-qualification):
andif T2 is at least as cv-qualified as T1, the target type is T2,- otherwise, no conversion sequence is formed for this operand;
- otherwise, if T2 is a base class of T1, the target type is cv1 T2, where cv1 denotes the cv-qualifiers of T1
,;- otherwise, the target type is the type that E2 would have after applying the lvalue-to-rvalue (7.3.2 [conv.lval]), array-to-pointer (7.3.3 [conv.array]), and function-to-pointer (7.3.4 [conv.func]) standard conversions.