This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Using declarations should not conflict (PR/2294) -TAKE 2
- From: Jason Merrill <jason at redhat dot com>
- To: "Giovanni Bajo" <giovannibajo at libero dot it>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 02 Dec 2003 00:26:18 -0500
- Subject: Re: [C++ PATCH] Using declarations should not conflict (PR/2294) -TAKE 2
- References: <008101c3b065$89d37cf0$1e01a8c0@prograph.it>
On Fri, 21 Nov 2003 20:27:43 +0100, "Giovanni Bajo" <giovannibajo@libero.it> wrote:
> ! if (!DECL_ARTIFICIAL (decl))
> {
> if (old && TREE_CODE (old) != OVERLOAD)
> new_binding = ovl_cons (decl, ovl_cons (old, NULL_TREE));
> *************** push_overloaded_decl (tree decl, int fla
> *** 2004,2010 ****
> OVL_USED (new_binding) = 1;
> }
> else
> - /* NAME is not ambiguous. */
> new_binding = decl;
This could use a comment about why artificial decls are being handled
specially.
> tree class_size = size_in_bytes (true_type);
> static const char alloc_name[] = "_Jv_AllocObject";
> use_java_new = 1;
> ! if (!get_global_value_if_present (get_identifier (alloc_name),
> ! &alloc_decl))
> fatal_error ("call to Java constructor with `%s' undefined",
> alloc_name);
> ! if (is_overloaded_fn (alloc_decl))
> ! {
> ! if (really_overloaded_fn (alloc_decl))
> ! fatal_error ("`%s' should never be overloaded", alloc_name);
> ! alloc_decl = OVL_FUNCTION (alloc_decl);
> ! }
You can use OVL_CURRENT rather than check is_overloaded_fn. Also, that
should be
internal_error ("`%D' should never be overloaded", alloc_decl);
We really don't want to use %s formatters if there's a better option
available, and I don't think this is an error worth aborting over. The
other one either, actually.
> + else if (is_overloaded_fn (fn))
> + {
> + if (really_overloaded_fn (fn))
> + fatal_error ("`%s' should never be overloaded", throw_name);
> + fn = OVL_FUNCTION (fn);
> + }
Same changes here. No need to introduce a new variable "throw_name".
Jason