[cfe-commits] libc++ and const expr.

Eli Friedman eli.friedman at gmail.com
Sat Feb 4 11:41:38 PST 2012


On Sat, Feb 4, 2012 at 11:27 AM, Joerg Sonnenberger
<joerg at britannica.bec.de> wrote:
> On Sat, Feb 04, 2012 at 11:53:28AM -0500, Howard Hinnant wrote:
>> But I note the crux of this issue appears to be that this:
>>
>>    static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
>>
>> is no longer consider a compile time constant expression.
>
> Ignoring the question of whether clang should allow that or not, why
> aren't you using the more compact statement below, which is just as
> portable:
>
> static const intmax_t -~(intmax_t)0;

-~0 is 1, not INT_MIN.

-Eli




More information about the cfe-commits mailing list