This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/44267] New: SFINAE does not handle down static_cast over virtual inheritance
- From: "cjoldfield at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 May 2010 05:41:43 -0000
- Subject: [Bug c++/44267] New: SFINAE does not handle down static_cast over virtual inheritance
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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_cast<D>(create<B>()))]);
template <class D, class B>
two& f(...);
int main()
{
f<D*, int>(0);
f<D*, B*>(0);
f<VD*, 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