use of 'static constexpr auto A::f()' before deduction of 'auto'

Viewed 88

This code won't compile:

struct A{
    static constexpr auto f(){
        return []{};
    }
    static constexpr auto x = f();
};

error: use of 'static constexpr auto A::f()' before deduction of 'auto'

I know there are multiple questions similar to this one but I really don't understand what in this specific case is preventing the compiler from doing its job. Also notice that the same code, outside a class definition, works perfectly.

0 Answers
Related