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: PR c++/34758 Bad diagnostic for circular dependency in constructor default argument


2009/2/8 Mark Mitchell <mark@codesourcery.com>:
> Manuel López-Ibáñez wrote:
>
> I don't understand:
>
> +      if (parmnum != 0 || !last_arg)
> +       error ("%qD needs to be declared before called with a default argument "
> +              "for parameter %d", fn, parmnum + 1);
> +      else
> +       error ("%qD needs to be declared before called with default argument",
> +              fn);
>
> Why are the first argument (parmnum == 0) and the last argument treated
> specially?  Is parmnum actually 0-based or 1-based?  (That's not
> documented at present; your patch should clarify that documentation.)
> In convert_for_initialization, parmnum is treated as 1-based; there is
> no "+1".

if parmnum == 0 && last_arg is true then there is only one argument,
so we give the second message. In any other case, there is more than
one argument, so we give the first message.

parmnum is 0-based, I can document that in the function comment.

Cheers,

Manuel.


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