[cfe-dev] A bunch of more or less related issues
Argyrios Kyrtzidis
kyrtzidis at apple.com
Mon Jun 29 10:57:20 PDT 2009
On Jun 29, 2009, at 9:06 AM, Olaf Krzikalla wrote:
> 2. What is the full expression according to ISO in "if (int a =
> expr)"?
> IMHO it is expr, but I'm not really sure since I saw
> CXXConditionDeclExpr.
Using just the expr is not correct, consider this case:
class C {
public:
C(bool b);
operator bool();
};
void f() {
if (C c = true) {
}
}
the condition used for "if" is not 'true' but the return value of
calling C::operator bool().
-Argiris
More information about the cfe-dev
mailing list