https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68942
Bug ID: 68942 Summary: overly strict use of deleted function before argument-dependent lookup (ADL) Product: gcc Version: 5.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lucdanton at free dot fr Target Milestone: --- Tested on 5.2.0, 5.2.1 and 6. I believe the testcase is incorrectly rejected. Clang accepts the program. Note that leaving void foo(int); undefined, rather than defined as deleted, lets GCC accept the program. $ g++-trunk -std=c++14 main.cpp main.cpp: In function 'void lookup(X)': main.cpp:5:3: error: use of deleted function 'void foo(int)' { foo(x); } ^~~ main.cpp:1:6: note: declared here void foo(int) = delete; ^~~ $ cat main.cpp void foo(int) = delete; template<typename X> void lookup(X x) { foo(x); } namespace ns { struct dummy {}; int foo(dummy) { return 3; } } // ns int main() { lookup(ns::dummy {}); }