When we see a '<' operator, check whether it's a probable typo for a template…

Description

When we see a '<' operator, check whether it's a probable typo for a template-id.

The heuristic that we use here is:

  • the left-hand side must be a simple identifier or a class member access
  • the right-hand side must be '<' followed by either a '>' or by a type-id that cannot be an expression (in particular, not followed by '(' or '{')
  • there is a '>' token matching the '<' token

The second condition guarantees the expression would otherwise be ill-formed.

If we're confident that the user intended the name before the '<' to be
interpreted as a template, diagnose the fact that we didn't interpret it
that way, rather than diagnosing that the template arguments are not valid
expressions.

Details

Committed
rsmithMay 9 2017, 7:30 PM
Parents
rL302614: Add MinGW64 builder to Appveyor.
Branches
Unknown
Tags
Unknown