[Bug c++/85461] A simple recursive TMP static const initializer defeats gcc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85461 --- Comment #3 from Andrew Pinski --- Using constexpr is a decent workaround. Note enum version of this is rejected by all compilers: template struct bitWidthHolding { enum {width = (v == 0) ? 0 : bitWidthHolding<(v>>1)>::width + 1}; }; int a = bitWidthHolding<255>::width; Which I find interesting.
[Bug c++/85461] A simple recursive TMP static const initializer defeats gcc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85461 Jonathan Wakely changed: What|Removed |Added Keywords||rejects-valid Status|UNCONFIRMED |NEW Last reconfirmed||2018-04-19 Ever confirmed|0 |1 --- Comment #2 from Jonathan Wakely --- I think https://wg21.link/cwg712 makes this valid.
[Bug c++/85461] A simple recursive TMP static const initializer defeats gcc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85461 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek --- The testcase is incomplete, something like: int a = bitWidthHolding<255>::width; is missing, otherwise it doesn't fail. The reason for giving up is that it tries to instantiate bitWidthHolding<0> many times, doesn't seem to be a regression, all gcc versions that have -std=c++0x support fail similarly.