This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/11867] New: static_cast ignores ambiguity


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11867

           Summary: static_cast ignores ambiguity
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alfred dot minarik dot 1 at aon dot at
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

Reading specs from /home/am/tools/gcc/usr/lib/gcc/i686-pc-linux-gnu/3.4/specs
Konfiguriert mit: /home/am/tools/gcc/gcc/configure
--prefix=/home/am/tools/gcc/usr --enable-languages=c,c++ --enable-threads=posix
--disable-checking
Thread model: posix
gcc-Version 3.4 20030809 (experimental)

(and all earlier versions)

fails to detect this ambiguity:

g++ ambig.c

-----ambig.c-----

void ambig()
{
  struct A {};
  struct B : A {};
  struct C : A {};
  struct D : B, C {};

	D d;
 	A* ap = static_cast<B*> (&d);
	D* db = static_cast<D*> (ap);  //err expected

	D& dr1 = static_cast<D&> (*ap);  //err expected

	A& ar = static_cast<C&> (d);
	D& dr = static_cast<D&> (ar);  //err expected
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]