[Bug c++/67625] some constexpr expressions rejected as enumerator value
olegendo at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 5 01:09:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67625
--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> ---
There is a funny work around for this though ...
#include <cstdint>
struct bswapped16
{
const uint16_t val;
constexpr bswapped16 (uint16_t v) : val (__builtin_bswap16 (v)) { }
};
constexpr uint16_t bswap16 (uint16_t x)
{
return bswapped16 (x).val;
}
enum { foo_4 = bswap16 (1) }; // OK
More information about the Gcc-bugs
mailing list