https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86978
Bug ID: 86978 Summary: constraints for friend functions ignored Product: gcc Version: c++-concepts Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: h2+bugs at fsfe dot org Target Milestone: --- Take the following code: template <typename t> struct S { template <typename t2> requires false friend void foobar(S, t2) {} }; int main() { foobar(S<double>{}, int{}); } Obviously the friend function should never be available, but the code compiles just fine, because apparently the constraints on friend functions are ignored entirely? This took quite long to find, because there is no diagnostic of any kind, just wrong behaviour. Tested with GCC 7.3 and 8.1 on godbolt.org I think this explains https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68093 as well, because of the constraints are stripped from friend functions than two functions which differ only in constraints appear as redefinitions.