This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix seg fault
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: mark at codesourcery dot com
- Date: Mon, 16 Sep 2002 16:17:37 +0100
- Subject: [C++ PATCH] Fix seg fault
- Organization: Codesourcery LLC
Hi,
I've installed this obvious patch for a seg fault which probably
was introduced by Mark's new parser reorg. lookup_member's comment
about when PROTECT issues an error is misleading.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2002-09-16 Nathan Sidwell <nathan@codesourcery.com>
* parse.y (parse_finish_call_expr): Check lookup_member result.
Index: cp/parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parse.y,v
retrieving revision 1.279
diff -c -3 -p -r1.279 parse.y
*** cp/parse.y 15 Aug 2002 21:16:52 -0000 1.279
--- cp/parse.y 16 Sep 2002 15:09:37 -0000
*************** parse_finish_call_expr (tree fn, tree ar
*** 4177,4182 ****
--- 4177,4188 ----
name = DECL_NAME (get_first_fn (name));
fn = lookup_member (scope, name, /*protect=*/1,
/*prefer_type=*/0);
+ if (!fn)
+ {
+ error ("'%D' has no member named '%E'", scope, name);
+ return error_mark_node;
+ }
+
if (BASELINK_P (fn) && template_id)
BASELINK_FUNCTIONS (fn)
= build_nt (TEMPLATE_ID_EXPR,
// { dg-do compile }
// Copyright (C) 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 16 Sep 2002 <nathan@codesourcery.com>
// Seg faulted.
struct Base
{
};
struct Derived : Base
{
void Foo ()
{
Base::Baz (); // { dg-error "has no member" "" }
};
};