https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93795
Bug ID: 93795 Summary: Out-of-line definition of class member template with 'requires std::invocable<T>' constraint fails to compile Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: plexando at protonmail dot com Target Milestone: --- A class member template having a constraint with a 'requires std::invocable<T>' clause fails to compile if defined out-of-line. For instance, the program #include <concepts> #include <iostream> struct S { template<typename T> requires std::invocable<T> void f(T&& t); }; template<typename T> requires std::invocable<T> void S::f(T&& t) { t(); } int main() { S{}.f([] { std::cerr << -1 << std::endl; }); } does not compile with GCC 10.0.1 20200214 (experimental) on x86_64 GNU/Linux (It does compile however if the member template is defined in-line). Compiler output (using g++ prog.cc -Wall -std=gnu++2a) is: prog.cc:13:1: error: no declaration matches 'void S::f(T&&)' 13 | S::f( | ^ prog.cc:7:10: note: candidate is: 'template<class T> requires invocable<T> void S::f(T&&)' 7 | void f(T&& t); | ^ prog.cc:4:8: note: 'struct S' defined here 4 | struct S { | ^ prog.cc:7:10: error: 'void S::f(T&&) [with T = main()::<lambda()>]', declared using local type 'main()::<lambda()>', is used but never defined [-fpermissive] 7 | void f(T&& t); | ^ prog.cc:7:10: warning: 'void S::f(T&&) [with T = main()::<lambda()>]' used but never defined Configure options were ./configure --prefix=/usr/local/gcc-10-20200209.