This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ Patch] PR 34758
Paolo Carlini wrote:
> Hi,
>> Obviously, if the error message doesn't make sense to someone as
>> knowledgeable about C++ as you, then we should do better. I just don't
>> see how the change suggested actually improves the situation.
>>
> ;) Thanks, I think that now I begin see... I got confused because an
> error message about line 2 (the constructor) actually only prints text
> referring to line 3 (and there, at line 3, *everything* has been
> parsed)... Seems just another example of the long standing issue about
> using carets in the error messages...
Yes, I think so. In just plain English, for:
A (const A& = A());
we want to say something like this:
In parsing the default argument to the first parameter to A::A, there is
a call to A::A. The matching constructor is "A::A(const A&)", which
matches because it has a default argument. But, we haven't finished
parsing that default argument yet, so this is an error.
Now, how do we translate that into an error message? Perhaps something
like:
error: default arguments for A::A(const A&) has not yet been parsed
inform: during processing of default argument for parameter 1 to
A::A(const A&)
This is still confusing in this case because both functions are the
same. But, for a case like the one we were talking about earlier this
would say:
error: default arguments for A::f(int) has not yet been parsed
inform: during processing of default argument for parameter 1 to
A::A(const A&)
Thoughts?
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713