This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Using declarations should not conflict (PR/2294) -TAKE 2


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]