https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67835
Bug ID: 67835 Summary: bug with auto-deduced return type and functions invoked via ADL Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ryan.burn at gmail dot com Target Milestone: --- The below code compiles fine with clang and EDG (intel's compiler) but gives this error with gcc: t.cpp: In instantiation of ‘auto g(Tag, T) [with Tag = abc::tag; T = abc::A]’: t.cpp:16:25: required from here t.cpp:3:11: error: use of ‘template<class T> auto abc::f(abc::tag, T)’ before deduction of ‘auto’ return f(tag, x); ^ t.cpp:3:11: error: use of ‘auto abc::f(abc::tag, T) [with T = abc::A]’ before deduction of ‘auto’ ///////////////////////////////////////////////////////////// template<class Tag, class T> auto g(Tag tag, T x) { return f(tag, x); } namespace abc { struct tag {}; struct A {}; template<class T> auto f(tag, T x) { return x; } } int main() { g(abc::tag(), abc::A()); return 0; } /////////////////////////////////////////////////////////////