[clang] [Clang] omit parentheses in fold expressions with a single expansion (PR #110761)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 14:19:30 PDT 2024


================
@@ -36,7 +36,7 @@ using r1i2 = r1<char>; // expected-error {{constraints not satisfied for class t
 template<typename... Ts> requires
 false_v<requires (Ts... ts) {requires ((sizeof(ts) == 2) && ...);}>
 // expected-note at -1 {{because 'false_v<requires (short ts, unsigned short ts) { requires (sizeof (ts) == 2) && (sizeof (ts) == 2); }>'}}
-// expected-note at -2 {{because 'false_v<requires (short ts) { requires (sizeof (ts) == 2); }>' evaluated to false}}
+// expected-note at -2 {{because 'false_v<requires (short ts) { requires sizeof (ts) == 2; }>' evaluated to false}}
----------------
cor3ntin wrote:

> Thats the discussion we had in a separate thread, we don't really see how, without modifying the ParenExpr to say that it is the result of a fold expr expansion.

Honestly not the worst idea?

We should test that the following still works

```cpp
void f(auto a, auto... b) {
    static_assert(__is_same_as(decltype((a)), int&));
    static_assert(__is_same_as(decltype(((b), ...)), int&));
};

int main() {
    int a = 0;
    f(a, a);
}
```

https://github.com/llvm/llvm-project/pull/110761


More information about the cfe-commits mailing list