constexpr
constexpr copied to clipboard
Counter Not Counting
Counter does not seem to be counting up.
∴ clang -std=c++1z -I../include cx_counter.cpp
cx_counter.cpp:6:3: error: static_assert failed "counter(1)"
static_assert(cx::counter() == 1, "counter(1)");
^ ~~~~~~~~~~~~~~~~~~
cx_counter.cpp:7:3: error: static_assert failed "counter(2)"
static_assert(cx::counter() == 2, "counter(2)");
^ ~~~~~~~~~~~~~~~~~~
cx_counter.cpp:8:3: error: static_assert failed "counter(3)"
static_assert(cx::counter() == 3, "counter(3)");
^ ~~~~~~~~~~~~~~~~~~
3 errors generated.
I suppose this counter implementation won't work when compiled with GCC 8 and above. Similar implementation works for me in case of all lower GCC versions.