This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[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>); // #1BeforeIssue 1895, #1 was well-formed.With the reformulation based on conversion sequences, #1 is nowill-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 abovecan be formed and at least one of the operands has (possiblycv-qualified) class type:
- if T1 and T2 are the same class type (ignoringcv-qualification):
andif T2 is at least as cv-qualified asT1, 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 afterapplying 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.