template<class> struct Base { }; struct Derived : Base<void> { }; template<template<typename> class TT, typename T> void func (TT<T>) { } int main () { func (Derived { }); } - - - - - - - - - - - - - - - - - - - - - - - - - - main.cpp: In function 'int main()': main.cpp:9:20: error: no matching function for call to 'func(Derived)' func (Derived { }); ^ main.cpp:9:20: note: candidate is: main.cpp:6:6: note: template<template<class> class TT, class T> void func(TT<T>) void func (TT<T>) { } ^ main.cpp:6:6: note: template argument deduction/substitution failed: main.cpp:9:20: note: can't deduce a template for 'TT<T>' from non-template type 'Derived' func (Derived { }); - - - - - - - - - - - - - - - - - - - - - - - - - - gcc rejects the snippet which is a violation of [temp.deduct.call]/4 (`clang` and `msvc` accepts the code). `TT<T>` is a `simple-template-id` and the standard says that if a derived type is passed to such context it should be deduced to a suitable base of that passed type. Correct behavior is that the deduced template parameters for `func (Derived {})` should be `TT = Base, T = void`.
Created attachment 32133 [details] testcase.cpp
Clang accepts the code.
This looks like a duplicate of a much older PR. *** This bug has been marked as a duplicate of bug 42329 ***