From: Gabriel Dos Reis Date: Fri, 13 Dec 2002 21:54:46 +0000 (+0000) Subject: re PR c++/8031 (ICE in comptypes, at cp/typeck.c:913) X-Git-Tag: releases/gcc-3.2.2~179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc18af8038069a9fe2a3c61717bdaf504f7166e2;p=thirdparty%2Fgcc.git re PR c++/8031 (ICE in comptypes, at cp/typeck.c:913) PR C++/8031 * cvt.c (convert_to_pointer_force): Don't try comparing against erronous type. From-SVN: r60105 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 213fc233e072..30704d90ecfe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2002-12-13 Gabriel Dos Reis + + PR C++/8031 + * cvt.c (convert_to_pointer_force): Don't try comparing against + erronous type. + 2002-12-10 Mark Mitchell PR c++/8372 diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 5e6c92c2bacf..1603a2a00adb 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -313,6 +313,8 @@ convert_to_pointer_force (type, expr) if (binfo) { expr = build_base_path (code, expr, binfo, 0); + if (expr == error_mark_node) + return error_mark_node; /* Add any qualifier conversions. */ if (!same_type_p (TREE_TYPE (TREE_TYPE (expr)), TREE_TYPE (type))) diff --git a/gcc/testsuite/g++.dg/conversion/to-virtual-base-1.C b/gcc/testsuite/g++.dg/conversion/to-virtual-base-1.C new file mode 100644 index 000000000000..3fa8e418e879 --- /dev/null +++ b/gcc/testsuite/g++.dg/conversion/to-virtual-base-1.C @@ -0,0 +1,15 @@ +// Copyright (C) 2002 Free Software Foundation +// Contributed by Gabriel Dos Reis + +struct A { + virtual void f(const A* a) = 0; +}; + +struct B : virtual A { + virtual void f(const A* a); +}; + +void B::f(const A* a) +{ + static_cast(*a); // { dg-error "" } +}