On Sat, Mar 10, 2018 at 6:57 AM, Alexandre Oliva <aol...@redhat.com> wrote: > If we get a parse error during an attempted fully implicit function > template parse, and need to skip to the end of the statement or block, > we may discard the function parms scope rather than the enclosing > injected implicit template parms scope. If we rollback a tentative > parse and try something else, we'll no longer be in a function parms > scope, but rather in a template parms scope, but we may still attempt > to synthesize implicit template parms and then fail the assert that > checks we're in a function parms scope. > > This patch introduces an alternative to > finish_fully_implicit_template_p, to be used during error recovery, > that floats the implicit template parm scope to the top so that it > gets discarded as we finish and discard the failed implicit template > data, while other scopes are retained as expected. It also clears the > implicit template parser data as we finish the template, so that it > doesn't linger on referencing discarded or used scopes and parms. > > Regstrapped on i686- and x86_64-linux-gnu. Ok to install?
OK. > While debugging this, I first tried another patch, that avoids the same > ICEs. I thought this one was a more complete solution, and it renders > the other unnecessary, but I still though it might be useful to disable > auto->implicit_parm while parsing declarators, so as to avoid useless > processing. Better, I think, to disable it while parsing attributes; we could still encounter auto as a template argument in a declarator. Jason