From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14856 invoked by alias); 18 Aug 2006 11:21:18 -0000 Received: (qmail 14390 invoked by uid 48); 18 Aug 2006 11:21:07 -0000 Date: Fri, 18 Aug 2006 11:21:00 -0000 Message-ID: <20060818112107.14389.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/27177] [4.0 Regression] ICE in build_simple_base_path, at cp/class.c:474 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "zak at transversal dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-08/txt/msg01431.txt.bz2 List-Id: ------- Comment #8 from zak at transversal dot com 2006-08-18 11:21 ------- However, that patch breaks the following code, which requires *implicit* derived-to-base conversion: ================================ struct Z {}; struct A : Z {}; Z* implicitToZ (Z*); struct B : A { static const int i = sizeof(implicitToZ((B*)0)); }; ================================ Without the patch, the above compiles cleanly (as it does in 4.0.3, 4.1.1 and Comeau). With the patch, I get: $ g++ -c dtob.cc dtob.cc:8: error: invalid conversion from 'B*' to 'Z*' dtob.cc:8: error: initializing argument 1 of 'Z* implicitToZ(Z*)' The standard (in 4.10 [conv.ptr], paragraph 3) states that a program requiring a derived-to-base conversion is ill-formed if the base class is inaccessible or ambiguous; it does not mention any requirement that the derived class must be complete. This breaks code like this using boost::is_base_and_derived (this is cut down from a real-world example): ================================ #include #include struct Base { }; template< typename T > struct A { BOOST_STATIC_ASSERT(( boost::is_base_and_derived< Base, T >::value )); struct Inner { }; }; struct Derived : Base { typedef A< Derived >::Inner Inner; }; ================================ -- zak at transversal dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |zak at transversal dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27177