http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52072
Bug #: 52072 Summary: Several non-deduced context not recognized Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: daniel.krueg...@googlemail.com gcc does not properly handle several situations where a non-deduced context should occur. E.g. the following program is rejected: //------- template<class T> struct ident { typedef T type; }; template<class T> void f(T, typename ident<T>::type*); // Line 5 struct B { typedef int* type; operator type(); }; int main() { f(0, B()); // Line 13 } //------- "In function 'int main()':| 13|error: no matching function for call to 'f(int, B)'| 13|note: candidate is:| 5|note: template<class T> void f(T, typename ident<T>::type*)| 5|note: template argument deduction/substitution failed:| 13|note: mismatched types 'typename ident<T>::type*' and 'B'|" It seems that the compiler only accepts situations, where the *complete* type is wrapped like in template<class T> void f(T, typename ident<T*>::type); But this behaviour does not match with the wording. According to [temp.deduct.type] p5 b1: "The non-deduced contexts are: — The nested-name-specifier of a type that was specified using a qualified-id." (The same rule exists in C++03, [temp.deduct.type] p4 b1) The behaviour of gcc looks extraordinary when compared with other compilers, vc10, clang, or comeau online accept the original code.