Skip to content

Fix subscript-expression to comply with C++23 comma separator rules #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

NEIL-smtg
Copy link

Creating this PR in response to #123

In C++23, the grammar for subscript-expressions was updated to accept an expression-list, which causes the top-level comma (,) to be treated as a separator rather than part of a single expression. This leads to parsing issues when using comma expressions directly inside subscript operators.

To address this, affected expressions have been wrapped in parentheses to ensure the intended evaluation order is preserved and to maintain compatibility with C++23 and beyond.

Example fix:

// Before (invalid in C++23):
while_(arg1--)
[
    cout << arg1 << ", ",
    ++ref(x)
]

// After (valid in C++23):
while_(arg1--)
[
    (cout << arg1 << ", ", ++ref(x))
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant