The expression ^operand is parsed through a sequence of tentative parses, which terminates when one succeeds (or else fails):
First, try parsing as a template
Otherwise, try parsing as a namespace
Otherwise, try parsing as a type-id
Otherwise, try parsing as an expression
We inherited this model from the old Lock3 implementation of P1240. It has so far served well, but as pointed out by Wyatt Childers, it does the wrong thing in cases like the following (godbolt):
The expression
^operand
is parsed through a sequence of tentative parses, which terminates when one succeeds (or else fails):We inherited this model from the old Lock3 implementation of P1240. It has so far served well, but as pointed out by Wyatt Childers, it does the wrong thing in cases like the following (godbolt):
We should try to rewrite this to leverage a single unqualified lookup rather than a sequence of tentative parses.