Skip to content

[BUG] comma-operator is irrelevant when parsing template-argument-list #103

Closed
@seanbaxter

Description

@seanbaxter

https://github.com/hsutter/cppfront/wiki/Design-note%3A-Unambiguous-parsing#a-first-match-wins-there-are-no-comma-expressions-and-a-relational-comparison-in-a-template-argument-must-be-parenthesized

In Cpp2 my intent is to make this a non-problem (famous last words!) by addressing this in two chunks:

  • Cpp2 has no comma operator, so that removes the possibility of b,c being a comma-expression.
  • Cpp2 requires a relational comparison expression in a template-argument-list to be parenthesized. (*)

In C++, b,c in a template-argument-list cannot be a comma-expression because the grammar sets the template-argument production to conditional-expression, which is higher precedence than expression, which is where the comma is parsed. The notes concerning comma-expression are irrelevant.

More generally, I don't see how context insensitivity is achieved. What is changed, other than requiring parens around comparisons in the template-argument-list?

f(temp_or_object<a, b>(c));

Is this disallowed Cpp2 syntax? It's definitely ambiguous.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions