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++/71251] out-of-range parms in tmpl arg substitution


On Mar 22, 2018, Jason Merrill <jason@redhat.com> wrote:

> On Tue, Mar 20, 2018 at 10:29 PM, Alexandre Oliva <aoliva@redhat.com> wrote:
>> On Mar 20, 2018, Jason Merrill <jason@redhat.com> wrote:
>> 
>>>> +  if (id == error_mark_node)
>>>> +    return error_mark_node;
>> 
>>> Why wait until here to return?  There are error returns immediately
>>> above and below your first hunk.
>> 
>> QOI.  Returning immediately, we then get other errors.  We could consume
>> tokens till the end of the declaration, but I figured we might as well
>> try to parse them and see whether there were any other legitimate errors
>> to report.

> It just seems a bit odd to have the check and the return so far apart.
> Do they need to be separate at all?

That depends on how much cp_parser_check_template_parameters depends on
the parser state; I worried moving it down might cause the template
state to have changed enough that the test wouldn't be testing what we
wanted any more, so I kept it right after parsing the identifier.

> I think we definitely want to move the check down below the
> cp_parser_commit_to_tentative_parse.

If you say that won't get it the wrong context for the test, sure.  I'll
run a test cycle with that change.

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer


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