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] PR 34758


Paolo Carlini wrote:

> adjusting the signature of convert_default_arg allows to deal rather
> cleanly IMHO with this issue. Tested x86_64-linux.
> 
> Ok for mainline?

!       if (parmnum != 0 || TREE_CHAIN (parm) != void_list_node)

I don't understand this conditional.  Why does it matter whether we're
looking at the first argument or not?

Also, I'm not sure I agree that "circular dependency" is a very clear
way to explain this problem.  If I recall correctly, there doesn't
actually have to be a circular dependency to make the code invalid.

In particular, if the default argument tried to invoke a method with
default arguments declared later in the class, I think we would have
trouble too:

  struct S {
    S(const S& = f());
    static const S& f(int i = 3);
  };

So, I'm not actually sure what's wrong with the current message.  I
think it explains the problem reasonably well.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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