Created on 2004-12-17.00:00:00 last changed 179 months ago
[Voted into WP at March, 2010 meeting.]
Proposed resolution (February, 2010):
This issue is resolved by the resolution of issue 976.
Notes from the April, 2005 meeting:
The CWG observed that there is nothing special about either bool or the context in the example above; instead, it will be a problem wherever a copy occurs, because cv-qualification is always dropped in a copy operation. This appears to be a case where the conversion deduction rules are not properly symmetrical with the rules for arguments. The example should be accepted.
An expression used in an if statement is implicitly converted to type bool (8.5 [stmt.select]). According to the rules of template argument deduction for conversion 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 is bool and P is const T (because cv-qualification is dropped from P before the reference is removed), and deduction fails.
It's not clear whether this is the intended outcome or not.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-03-29 00:00:00 | admin | set | messages: + msg2743 |
2010-03-29 00:00:00 | admin | set | status: tentatively ready -> cd2 |
2010-02-16 00:00:00 | admin | set | messages: + msg2514 |
2010-02-16 00:00:00 | admin | set | status: drafting -> tentatively ready |
2005-05-01 00:00:00 | admin | set | messages: + msg1168 |
2005-05-01 00:00:00 | admin | set | status: open -> drafting |
2004-12-17 00:00:00 | admin | create |