[Bug c++/44267] SFINAE does not handle down static_cast over virtual inheritance
--- Comment #2 from cjoldfield at gmail dot com 2010-05-25 17:09 --- Intel 11.1 accepts it, but it doesn't even try to instantiate one f(...). To see what I mean, try replacing main with: #include iostream int main() { std::cout sizeof(fD*, int(0)) std::endl; std::cout sizeof(fD*, B*(0)) std::endl; std::cout sizeof(fVD*, B*(0)) std::endl; } Also for intel, if one forces it to try to instantiate one f(...) by removing two f(...), it will complain that there is no matching call to f...(0) for all three calls (it should match the second). In this situation, gcc only complains about the first and the last, which is the expected behavior. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44267
[Bug c++/44267] New: SFINAE does not handle down static_cast over virtual inheritance
g++ fails to overlook template instantiation errors involving down static_casts over virtual inheritance boundaries. Example: struct B {}; struct D : B {}; struct VD : virtual B {}; template class T T create(); typedef char one[1]; typedef char two[2]; template class D, class B one f(char (*)[sizeof(static_castD(createB()))]); template class D, class B two f(...); int main() { fD*, int(0); fD*, B*(0); fVD*, B*(0); return 0; } gives error: cannot convert from base B to derived type VD via virtual base B Expected behavior is for template instantiation to fail for the first template f function and selection of the second template f function. Same issue for gcc 4.3.4. May be related to report 41468. -- Summary: SFINAE does not handle down static_cast over virtual inheritance Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cjoldfield at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44267
[Bug c++/44239] New: Spurious partial explicit specialization when taking the address of a template function.
Problem: template class T const T max(const T x, const T y){ return x y ? x : y; } template class T, class C const T max(const T x, const T y, C comp){ return comp(x, y) ? y : x; } template class R, class A0, class A1 struct functor{ template class F functor(F f) : f(f) {} R (*f)(A0, A1); }; int main(void){ functorconst int, const int, const int func(maxint); return 0; } results in error: no matching function for call to functorconst int, const int, const int::functor(unresolved overloaded function type) Only candidate constructor is the default copy constructor. After removing the two parameter max template, compiles clean. The code is boiled down from a problem using std::max with boost::function. -- Summary: Spurious partial explicit specialization when taking the address of a template function. Product: gcc Version: 4.3.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cjoldfield at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44239
[Bug c++/44243] New: Spurious partial explicit specialization when taking the address of a template function.
Problem: template class T const T max(const T x, const T y){ return x y ? x : y; } template class T, class C const T max(const T x, const T y, C comp){ return comp(x, y) ? y : x; } template class R, class A0, class A1 struct functor{ template class F functor(F f) : f(f) {} R (*f)(A0, A1); }; int main(void){ functorconst int, const int, const int func(maxint); return 0; } results in error: no matching function for call to functorconst int, const int, const int::functor(unresolved overloaded function type) Only candidate constructor is the default copy constructor. After removing the two parameter max template, compiles clean. The code is boiled down from a problem using std::max with boost::function. -- Summary: Spurious partial explicit specialization when taking the address of a template function. Product: gcc Version: 4.3.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cjoldfield at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44243
[Bug c++/44243] Spurious partial explicit specialization when taking the address of a template function.
--- Comment #1 from cjoldfield at gmail dot com 2010-05-22 17:33 --- *** This bug has been marked as a duplicate of 44239 *** -- cjoldfield at gmail dot com changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||DUPLICATE http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44243
[Bug c++/44239] Spurious partial explicit specialization when taking the address of a template function.
--- Comment #2 from cjoldfield at gmail dot com 2010-05-22 17:33 --- *** Bug 44243 has been marked as a duplicate of this bug. *** -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44239