Errors from nested templated lambdas

Viewed 69

GCC considers the following piece of code as ill-formed where as clang produces an internal compiler error.

template <auto V1 = []{ return 0; }>
struct s {
    template <auto V2 = []{ return V1(); }>
    consteval int foo() { return V2(); }
};

int main() {
    return s{}.foo(); // error
}

Is this code valid according the standard ?

0 Answers
Related