-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingcompilerCompiler work involvedCompiler work involvedfixedSomething works now, yay!Something works now, yay!
Description
Per [bit.pow.two]/8 std::bit_ceil(meow) is not a core constant expression when the smallest power of two greater than or equal to meow is not representable by the type decltype(meow). This is not the case for all supported types and all supported compilers with our implementation as witnessed by this ill-formed TU:
#include <bit>
using UC = unsigned char;
using US = unsigned short;
using UI = unsigned int;
using UL = unsigned long;
using ULL = unsigned long long;
// All static_asserts are ill-formed since their
// arguments are not constant expressions.
// None of Clang/EDG/MSVC diagnose these:
static_assert(((void)std::bit_ceil(UC(-1)), true));
static_assert(((void)std::bit_ceil(US(-1)), true));
// Clang and EDG, but not MSVC, diagnose these:
static_assert(((void)std::bit_ceil(UI(-1)), true));
static_assert(((void)std::bit_ceil(UL(-1)), true));
static_assert(((void)std::bit_ceil(ULL(-1)), true));There's almost certainly an MSVC compiler bug here, and probably a library bug as well.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcompilerCompiler work involvedCompiler work involvedfixedSomething works now, yay!Something works now, yay!