https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118354
Bug ID: 118354 Summary: Address-of result of a function template specialization may be treated as the function itself Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: de34 at live dot cn Target Milestone: --- GCC is currently accepting the following ill-formed program (https://godbolt.org/z/Gsrs7sxGW), while it shouldn't. &test<int> should be a void(*)(int) prvalue and thus cannot be bound to void(&)(int) or void(&&)(int). ``` template<class T> void from_lvalue(T& t) {} template<class T> void from_lvalue(T&&) = delete; template<typename T> void test(T a) {} int main() { (void) ::from_lvalue<void(int)>(&test<int>); } ``` It's curious that if test<int> is replaced with a non-template function of the same type, GCC correctly rejects such usage.