[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug? std::string promoted to bool???
From: |
address@hidden |
Subject: |
Re: Bug? std::string promoted to bool??? |
Date: |
Wed, 13 May 2015 11:12:39 -0700 (PDT) |
User-agent: |
G2/1.0 |
среда, 13 мая 2015 г., 5:47:40 UTC+3 пользователь U.Mutlu написал:
> The 2nd par should be a bool not a std::string.
> IMO the compiler should generate a warning (actually even an error) about it.
...
> func(S, "X"); // <-- HERE
It is char *, not a std::string.
>From docs:
Boolean conversions
Prvalues of integral, floating-point, unscoped enumeration, pointer, and
pointer-to-member types can be converted to prvalues of type bool.
The value zero (for integral, floating-point, and unscoped enumeration) and the
null pointer and the null pointer-to-member values become false. All other
values become true.