The following very simple code fails to compile: /////////////////////////////////// template<typename Ts> struct refines : Ts {}; struct A {}; struct B : refines<A> {}; struct C : refines<B> {}; void fun(void *) {} template<typename T> int fun(refines<T> *) { return 0; } int main() { C *p = 0; int i = fun(p); } ////////////////////
Also fails for the 4.9.0 trunk, the relevant part of the error message being <quote> main.cpp: In function 'int main()': main.cpp:29:16: error: void value not ignored as it ought to be int i = fun(p); ^ </quote>
Which template argument deduction should be take, B or A?
B
Clang accepts the code.
Seems to work in GCC 11+
Fixed with r11-4693-ged7f9957bbb5e899. *** This bug has been marked as a duplicate of bug 97453 ***