https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85461

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Using constexpr is a decent workaround.
Note enum version of this is rejected by all compilers:
template<unsigned int v>
struct bitWidthHolding {
    enum {width = (v == 0) ? 0 : bitWidthHolding<(v>>1)>::width + 1};
};
int a = bitWidthHolding<255>::width;

Which I find interesting.

Reply via email to