-
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
Regression in clang-format-17 #62055
Comments
@llvm/issue-subscribers-clang-format |
Bisected to bb4f6c4, which is my commit, sorry |
It appears this is symptoms of a bigger bug. When I made that patch, I assumed that For example: foo<a &&b>::x = 0; I am 80% sure this could be valid C++ syntax in some cryptic scenario (a class with a NTTP, and an assignment to a static member variable). The It also just so happens that this somewhat cryptic pattern is actually not that cryptic when dealing with SFINAE magic. EDIT: You don't even need cryptic syntax. Going by the original bug's syntax, even this is enough: foo<a &&b> *c = nullptr; EDIT2: Nevermind, this has nothing to do with contexts, there just a strange correcting term that is run right after |
After clang-format has determined that an equals sign starts an expression, it will also go backwards and modify any star/amp/ampamp binary operators on the left side of the assignment to be pointers/references instead. There already exists logic to skip over contents of parentheses and square brackets, but this patch also expands that logic to apply to angle brackets. This is so that binary operators inside of template arguments would not be touched, primary arguments to non-type template parameters. Fixes llvm#62055 Reviewed By: owenpan, MyDeveloperDay, HazardyKnusperkeks Differential Revision: https://reviews.llvm.org/D148024
clang-format.txt is attached.
The text was updated successfully, but these errors were encountered: