On 11/29/18 1:28 PM, Marek Polacek wrote:
On Wed, Nov 28, 2018 at 10:34:11PM -0500, Jason Merrill wrote:
On 11/28/18 10:48 AM, Marek Polacek wrote:
Since P0846R0 was implemented, a name will be treated as a template-name when
it is an unqualified-id followed by a < and name lookup finds either one or
more functions or finds nothing, in order to potentially cause ADL to be 
performed.

In this case, we had

    f<T> ();

where we'd found a decl for f (not a TEMPLATE_DECL) and < follows.

 From the backtrace in the PR, it seems as though we're treating f<T> as
non-dependent, which is wrong.  type_dependent_expression_p only looks at
the arguments of a TEMPLATE_ID_EXPR if it has unknown_type_node, so we
probably want to give it that type.

That was my first attempt but it was crashing everywhere, so I abandoned it.
But I was setting unknown_type_node in cp_parser_template_name whereas this
patch sets it in cp_parser_postfix_expression, which works and is arguably
better because it reuses the diagnostic in finish_call_expr.

Would it work for lookup_template_function to always use unknown_type_node?

Jason

Reply via email to