-
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
[format] Complex requires clauses get formatted wildly #63251
Comments
Here's a smaller one that goes wrong already, the #include <concepts>
template <class T, class E>
void Result()
requires(!((std::is_void_v<T> || std::is_void_v<T>)&&::std::is_void_v<E>))
{} Instead of #include <concepts>
template <class T, class E>
void Result()
requires(!((std::is_void_v<T> || std::is_void_v<T>) && ::std::is_void_v<E>))
{} |
@llvm/issue-subscribers-clang-format |
Further reduction of the second case: void main()
requires(((A<T>)&&B))
{} Pertinent debug information:
The |
Thank you so much! This issue has annoyed me for awhile |
When parsing a requires clause, the UnwrappedLineParser would delegate to parseParens with an AmpAmpTokenType set to BinaryOperator. However, parseParens would not carry this over into any nested parens, meaning it could assign a different token type to an && in a requires clause. This patch makes sure parseParens inherits its parameter when performing a recursive call. Fixes llvm/llvm-project#63251 Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay Differential Revision: https://reviews.llvm.org/D153641
Clang-format produces this:
Instead of something like this:
&&
after it.See it in action: https://godbolt.org/z/br3hddTbf
The text was updated successfully, but these errors were encountered: