public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/44267]  New: SFINAE does not handle down static_cast over virtual inheritance
@ 2010-05-25  5:42 cjoldfield at gmail dot com
  2010-05-25  9:28 ` [Bug c++/44267] " paolo dot carlini at oracle dot com
  2010-05-25 17:09 ` cjoldfield at gmail dot com
  0 siblings, 2 replies; 8+ messages in thread
From: cjoldfield at gmail dot com @ 2010-05-25  5:42 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]

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


^ permalink raw reply	[flat|nested] 8+ messages in thread
[parent not found: <bug-44267-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-09-24  9:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-25  5:42 [Bug c++/44267] New: SFINAE does not handle down static_cast over virtual inheritance cjoldfield at gmail dot com
2010-05-25  9:28 ` [Bug c++/44267] " paolo dot carlini at oracle dot com
2010-05-25 17:09 ` cjoldfield at gmail dot com
     [not found] <bug-44267-4@http.gcc.gnu.org/bugzilla/>
2011-09-23 21:45 ` paolo.carlini at oracle dot com
2011-09-23 23:06 ` jason at gcc dot gnu.org
2011-09-23 23:50 ` paolo.carlini at oracle dot com
2011-09-24 10:05 ` paolo at gcc dot gnu.org
2011-09-24 10:39 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).