// { dg-do compile { target c++17 } } // { dg-options "-fconcepts" } // { dg-skip-if "requires hosted libstdc++ for cassert" { ! hostedlib } } #include template concept Class = __is_class(T); template concept Empty = Class and __is_empty(T); template int f(T) { return 1; } template int f(T) { return 2; } struct S { template int f(T) { return 1; } template int f(T) { return 2; } } s; struct X { } x; struct Y { X x; } y; int main () { auto p1 = &f; // Empty f assert(p1(x) == 2); auto p2 = &f; // Class f assert(p2(y) == 1); auto p3 = &S::template f; // Empty f assert((s.*p3)(x) == 2); auto p4 = &S::template f; // Empty f assert((s.*p4)(y) == 1); }