Re: [PR c++/71251] out-of-range parms in tmpl arg substitution

2018-03-22 Thread Jason Merrill
OK. On Fri, Mar 23, 2018 at 12:04 AM, Alexandre Oliva wrote: > On Mar 22, 2018, Jason Merrill wrote: > >> I think we definitely want to move the check down below the >> cp_parser_commit_to_tentative_parse. > > This worked. Regstrapped on i686- and x86_64-linux-gnu. Ok to install? > > [PR c++/7

Re: [PR c++/71251] out-of-range parms in tmpl arg substitution

2018-03-22 Thread Alexandre Oliva
On Mar 22, 2018, Jason Merrill wrote: > I think we definitely want to move the check down below the > cp_parser_commit_to_tentative_parse. This worked. Regstrapped on i686- and x86_64-linux-gnu. Ok to install? [PR c++/71251] check tmpl parms in template using decl Check that template using d

Re: [PR c++/71251] out-of-range parms in tmpl arg substitution

2018-03-22 Thread Alexandre Oliva
On Mar 22, 2018, Jason Merrill wrote: > On Tue, Mar 20, 2018 at 10:29 PM, Alexandre Oliva wrote: >> On Mar 20, 2018, Jason Merrill wrote: >> + if (id == error_mark_node) +return error_mark_node; >> >>> Why wait until here to return? There are error returns immediately >>> abov

Re: [PR c++/71251] out-of-range parms in tmpl arg substitution

2018-03-22 Thread Jason Merrill
On Tue, Mar 20, 2018 at 10:29 PM, Alexandre Oliva wrote: > On Mar 20, 2018, Jason Merrill 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 im

Re: [PR c++/71251] out-of-range parms in tmpl arg substitution

2018-03-20 Thread Alexandre Oliva
On Mar 20, 2018, Jason Merrill 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 th

Re: [PR c++/71251] out-of-range parms in tmpl arg substitution

2018-03-20 Thread Jason Merrill
On Tue, Mar 20, 2018 at 6:51 PM, Alexandre Oliva wrote: > On Mar 20, 2018, Jason Merrill wrote: > >> On Tue, Mar 20, 2018 at 4:15 PM, Alexandre Oliva wrote: >>> Should we aim at rejecting the declaration of U? > >> Yes. > > Like this? > > [PR c++/71251] check tmpl parms in template using decl >

Re: [PR c++/71251] out-of-range parms in tmpl arg substitution

2018-03-20 Thread Alexandre Oliva
On Mar 20, 2018, Jason Merrill wrote: > On Tue, Mar 20, 2018 at 4:15 PM, Alexandre Oliva wrote: >> Should we aim at rejecting the declaration of U? > Yes. Like this? [PR c++/71251] check tmpl parms in template using decl Check that template using decls have the correct number of parm lists.

Re: [PR c++/71251] out-of-range parms in tmpl arg substitution

2018-03-20 Thread Jason Merrill
On Tue, Mar 20, 2018 at 4:15 PM, Alexandre Oliva wrote: > On Mar 20, 2018, Jason Merrill wrote: > >> On Sat, Mar 17, 2018 at 8:13 AM, Alexandre Oliva wrote: >>> As we go through each of the template parameters, substituting it with >>> corresponding template arguments, an incorrect argument list

Re: [PR c++/71251] out-of-range parms in tmpl arg substitution

2018-03-20 Thread Alexandre Oliva
On Mar 20, 2018, Jason Merrill wrote: > On Sat, Mar 17, 2018 at 8:13 AM, Alexandre Oliva wrote: >> As we go through each of the template parameters, substituting it with >> corresponding template arguments, an incorrect argument list might >> cause us to index argument vectors past their length

Re: [PR c++/71251] out-of-range parms in tmpl arg substitution

2018-03-20 Thread Jason Merrill
On Sat, Mar 17, 2018 at 8:13 AM, Alexandre Oliva wrote: > As we go through each of the template parameters, substituting it with > corresponding template arguments, an incorrect argument list might > cause us to index argument vectors past their length (or fail in the > preceding tree checks). Av

[PR c++/71251] out-of-range parms in tmpl arg substitution

2018-03-17 Thread Alexandre Oliva
As we go through each of the template parameters, substituting it with corresponding template arguments, an incorrect argument list might cause us to index argument vectors past their length (or fail in the preceding tree checks). Avoid such dereferences and instead issue an error (if requested) i