Pack indexing specifier can't be used with templated function declaration inside a class (original) (raw)

Example:

#include

template<typename... Ts> using front_t = Ts...[0];

struct Foo { template<typename... Ts> requires std::same_as<Ts...[0], int> static auto buggy() -> void;

template<typename... Ts>
    requires std::same_as<front_t<Ts...>, int>
static auto working() -> void;

};

template<typename... Ts> requires std::same_as<Ts...[0], int> auto Foo::buggy() -> void {}

template<typename... Ts> requires std::same_as<front_t<Ts...>, int> auto Foo::working() -> void {}

int main() { Foo::buggy(); Foo::working(); }

<source>🔞11: error: out-of-line definition of 'buggy' does not match any declaration in 'Foo'
   18 | auto Foo::buggy() -> void {}
      |           ^~~~~
<source>:6:8: note: Foo defined here
    6 | struct Foo {
      |        ^~~
1 error generated.
Compiler returned: 1