https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90642
Bug ID: 90642 Summary: g++ fails to resolve template function overload Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: oknenavin at outlook dot com Target Milestone: --- the following code fails to compile: template <typename X = int, typename T, typename ...R> inline void func(const T&, R...) {} template <typename T> struct S {}; template <typename X = int, typename T, typename ...R> inline void func(const S<T>&, R...) {} int main() { func(42); func(S<int>()); // OK func(S<int>(), 1); // NOK func<int>(S<int>(), 1); // NOK } with: <source>: In function 'int main()': <source>:13:21: error: call of overloaded 'func(S<int>, int)' is ambiguous func(S<int>(), 1); // NOK ^ <source>:13:21: note: candidates are: <source>:2:17: note: void func(const T&, R ...) [with X = int; T = S<int>; R = {int}] inline void func(const T&, R...) {} ^ <source>:8:17: note: void func(const S<T>&, R ...) [with X = int; T = int; R = {int}] inline void func(const S<T>&, R...) {} ^ <source>:14:26: error: call of overloaded 'func(S<int>, int)' is ambiguous func<int>(S<int>(), 1); // NOK ^ ... Reproducible with 4.8.1 and 9.1. Compiles with clang (v3.0.0 and v8.0.0), icc (v13.0.1 and v19.0.1), msvc (v19.14 and v19.20).