On Sat, Mar 31, 2018 at 4:23 AM, Alexandre Oliva <aol...@redhat.com> wrote: > On Mar 30, 2018, Jason Merrill <ja...@redhat.com> wrote: > >> True, it looks like sometimes we build a TEMPLATE_ID_EXPR with an >> IDENTIFIER_NODE. Looking at tsubst_copy_and_build, I see that we >> don't call finish_id_expression when substituting such a >> TEMPLATE_ID_EXPR. So maybe lookup_template_function and >> lookup_template_variable are the right places for this test. > > Nevermind the earlier email about multiple errors. I realized that we > save the preparsed template_id right after the tests in > cp_parser_template_id, and if only I don't stop the rejected template > from being saved, we avoid the duplicate errors, as in the patch below. > > A slight variant of this passed regstrap on i686- and x86_64-linux-gnu. > Ok to install, though it does not catch such cases as: > > template <typename T> > void foo(T t) { > typename T::template C<auto> u = t; > T::template C<auto> (t); > T::template C<auto>::f (t, u); > } > > ?
We should be able to distinguish those cases based on tag_type. Jason