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

Joerg Sonnenberger joerg at britannica.bec.de
Sat Feb 4 11:27:24 PST 2012


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;

Joerg



More information about the cfe-commits mailing list