-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Copy link
Labels
clang-formatinvalid-code-generationTool (e.g. clang-format) produced invalid code that no longer compilesTool (e.g. clang-format) produced invalid code that no longer compilesregression
Description
Clang-format on the recent 20.1 release now incorrectly formats variadic pack expansions that have assignments in them.
A test-case is a hash-combine function:
constexpr unsigned long long hash_combine(unsigned long long hash_a, unsigned long long hash_b)
{
hash_a ^= hash_b + 0x9e37'79b9 + (hash_a << 6) + (hash_a >> 2);
return hash_a;
}
template <typename... H>
constexpr unsigned long long hash_combine_n(unsigned long long hash_a, H... hash_b)
{
((hash_a = hash_combine(hash_a, hash_b)), ...);
return hash_a;
}
It formats hash_combine_n to:
template <typename... H>
constexpr unsigned long long hash_combine_n(unsigned long long hash_a,
H... hash_b)
{
(hash_a = hash_combine(hash_a, hash_b), ...);
return hash_a;
}
Metadata
Metadata
Assignees
Labels
clang-formatinvalid-code-generationTool (e.g. clang-format) produced invalid code that no longer compilesTool (e.g. clang-format) produced invalid code that no longer compilesregression