Skip to content
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

[clang-format] Incorrect star/amp annotation in requires expression outside of requires clause #59600

Closed
rymiel opened this issue Dec 19, 2022 · 2 comments
Assignees

Comments

@rymiel
Copy link
Member

rymiel commented Dec 19, 2022

Consider the following variable template:

template <typename T> bool canBar = requires(T && t) { t.bar(); };

Note the incorrect spacing of the &&, as it is annotated with T=BinaryOperator.
This issue doesn't exist for concept definitions:

template <typename T>
concept canBar = requires(T &&t) { t.bar(); };

Style: {} (empty)
Reproduced on main (6161a8d) and 15.0.2

@rymiel rymiel self-assigned this Dec 19, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Dec 19, 2022

@llvm/issue-subscribers-clang-format

@rymiel
Copy link
Member Author

rymiel commented Dec 19, 2022

Patch: https://reviews.llvm.org/D140330

@rymiel rymiel added the awaiting-review Has pending Phabricator review label Dec 19, 2022
@rymiel rymiel closed this as completed in 0ebed86 Dec 23, 2022
@github-actions github-actions bot removed the awaiting-review Has pending Phabricator review label Dec 23, 2022
CarlosAlbertoEnciso pushed a commit to SNSystems/llvm-debuginfo-analyzer that referenced this issue Dec 25, 2022
Previously, the parens of a requires expression's "parameters" were not
explicitly set, meaning they ended up as whatever the outer scope was.
This is a problem in some cases though, since the process of determining
star/amp checks if the token is inside of an expression context

This patch always makes sure the context between those parens are always
set to not be an expression

Fixes llvm/llvm-project#59600

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D140330
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants