I'm trying to define a lambda template variable (static constexpr) inside of a template class. The template variable takes in a NTTP, which I want to be a size_t.

I'm able to do so in certain situations, like if the NTTP is auto instead of size_t. I'm also able to do so if the class itself isn't a template class. But if I try to use a NTTP (size_t) for the lambda within a template class, I get:

internal compiler error: unexpected expression ‘<enumerator>’ of kind template_parm_index

Live example: https://onlinegdb.com/Sk3wC7nyP

Code below:

template<size_t>
struct Foo{
    // internal compiler error: unexpected expression ‘<enumerator>’ of kind template_parm_index
    template<size_t>
    static constexpr auto foo = [](){};
};

template<size_t>
struct Bar{
    // OK
    template<auto>
    static constexpr auto foo = [](){};
};

struct Baz{
    // OK
    template<size_t>
    static constexpr auto bar = [](){};
};
0

There are 0 answers