From the following code:
struct Foo
{
static constexpr int f() { return 42; }
static_assert(f() == 42); // ERROR
};
I'm getting:
C2131: Expression did not evaluate to a constant
But the following works:
struct Foo
{
static constexpr int f() { return 42; }
};
static_assert(Foo::f() == 42); // OK
and the following also works:
template<int x>
struct Foo
{
static constexpr int f() { return 42; }
static_assert(f() == 42); // OK
};
Any idea what's going on here?