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
[Voted into WP at March, 2010 meeting.]
An expression used in anif statement is implicitlyconverted to typebool (8.5 [stmt.select]).According to the rules of template argument deduction forconversion functions given in 13.10.3.4 [temp.deduct.conv],the following example is ill-formed:
struct X { template<class T> operator const T&() const; }; int main() { if( X() ) {} }Following the logic in 13.10.3.4 [temp.deduct.conv],A isbool andP isconst T(because cv-qualification is dropped fromP before thereference is removed), and deduction fails.
It's not clear whether this is the intended outcome ornot.
Notes from the April, 2005 meeting:
The CWG observed that there is nothing special about eitherbool or the context in the example above; instead, itwill be a problem wherever a copy occurs, because cv-qualificationis always dropped in a copy operation. This appears to be a casewhere the conversion deduction rules are not properly symmetricalwith the rules for arguments. The example should be accepted.
Proposed resolution (February, 2010):
This issue is resolved by the resolution ofissue 976.