This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: fix crash with un-annotated fields
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 14 Jan 2005 23:04:49 -0700
- Subject: [gcjx] Patch: FYI: fix crash with un-annotated fields
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
This code caused a crash when trying to resolve the warning
suppressions for a field. Replacing the old-style cast with a
const_cast<> fixed the problem.
Apparently this is an artifact of using a newer compiler, I only
started seeing this with the current cvs head.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* model/field.cc (type): Use const_cast.
Index: model/field.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/model/Attic/field.cc,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 field.cc
--- model/field.cc 13 Jan 2005 03:18:36 -0000 1.1.2.1
+++ model/field.cc 15 Jan 2005 06:07:23 -0000
@@ -1,6 +1,6 @@
// Fields.
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -68,11 +68,9 @@
{
resolution_scope scope;
declaring_class->push_on_scope (&scope);
- // FIXME: ugly cast.
- resolution_scope::push_warnings warn_holder (&scope,
- (IAnnotatable *) this);
- // FIXME: ugly cast.
- ((model_field *) this)->resolve_classes (&scope);
+ model_field *unconst_this = const_cast<model_field *> (this);
+ resolution_scope::push_warnings warn_holder (&scope, unconst_this);
+ unconst_this->resolve_classes (&scope);
}
return model_variable_decl::type ();