On 12/6/18 11:33 AM, Marek Polacek wrote:
This patch fixes a bogus parse error with ~ in a template-argument-list. We
have
S<int, ~value <int>>
and cp_parser_template_argument just tries to parse each argument as a type,
id-expression, etc to see what sticks. When it sees ~value, it tries to parse
it using cp_parser_class_name (because of the ~), which ends up calling
cp_parser_lookup_name, looking for "value", but finds nothing. Since it's an
unqualified-id followed by <, we treat "~value<int>" as a template name
function. It isn't followed by "(args)", so we simulate parse error. As a
consequence of this error, the parsing of the outermost template-id S fails.
The problem is that when we're looking up the name in cp_parser_class_name,
tag_type is typename_type, which means bindings that do not refer to types
are ignored, so the variable template "value" isn't found and we're toast.
Bootstrapped/regtested on x86_64-linux, ok for trunk?
OK.
Jason