This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11867] New: static_cast ignores ambiguity
- From: "alfred dot minarik dot 1 at aon dot at" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Aug 2003 12:25:33 -0000
- Subject: [Bug c++/11867] New: static_cast ignores ambiguity
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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
}