On Apr 2, 2018, Jason Merrill <ja...@redhat.com> wrote: > 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: >> 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. Uhh... I don't see how. I mean, yeah, if we see typename or any other tag first, tag_type will tell us we must find types for anything template-like, be it an intermediate scope or the final typename. However, if we see 'T::template C<auto> (t)', we can't tell whether T::C is a template class and we're "calling a constructor" to create a temporary out of t, or T::C is a static member template function that's being called with t as an argument. (ok, we know from the typename line that C is a type, but nevermind that, it could be a different name in the testcase, and then we wouldn't; heck, couldn't it even be a template function hiding the template class of the same name?) And then, while we're parsing "template C<auto>", we haven't yet reached the '::' after the closing angle bracket that would tell us to regard the id necessarily as a typename, so I don't see how we'd get a scope_type in tag_type for the third case. -- 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