-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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 formatting with &
qualifier and requires clause with multi-arg template
#65904
Labels
Comments
It does very wrong things with whatever comes after as well: struct S {
template <class... Args>
constexpr void f() && requires(true && C<true, Args...>) { return; }
private : int i;
}; |
It seems that for this bug to show up, you need both the parentheses after the |
rymiel
added a commit
to rymiel/llvm-project
that referenced
this issue
Sep 10, 2023
clang-format uses a heuristic to determine if a requires() is either a requires clause or requires expression, based on what is in the parentheses. Part of this heuristic assumed that a requires clause can never contain a comma, however this is not the case if said comma is in the template argument of a type. This patch allows commas to appear in a requires clause if an angle bracket `<` has been opened. Fixes llvm#65904
That was fast, thank you =) |
rymiel
added a commit
that referenced
this issue
Sep 27, 2023
clang-format uses a heuristic to determine if a requires() is either a requires clause or requires expression, based on what is in the parentheses. Part of this heuristic assumed that a requires clause can never contain a comma, however this is not the case if said comma is in the template argument of a type. This patch allows commas to appear in a requires clause if an angle bracket `<` has been opened. Fixes #65904
legrosbuffle
pushed a commit
to legrosbuffle/llvm-project
that referenced
this issue
Sep 29, 2023
clang-format uses a heuristic to determine if a requires() is either a requires clause or requires expression, based on what is in the parentheses. Part of this heuristic assumed that a requires clause can never contain a comma, however this is not the case if said comma is in the template argument of a type. This patch allows commas to appear in a requires clause if an angle bracket `<` has been opened. Fixes llvm#65904
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The first one has no
&
qualifier and is formatted correct.The second one adds
&
and clang-format gets confused, I don't think it's aware this is a function anymore.The
const
andconst&
qualifiers are parsed correctly.&&
is also incorrect.https://godbolt.org/z/qKTWec96e
The text was updated successfully, but these errors were encountered: