Issue 152266
Summary clang-format requires not using requires requires in order to correctly format a function type in a template parameter
Labels clang-format
Assignees
Reporter jacobsa
    Given this input:

```c++
template <typename... Ts>
  requires requires {
 requires std::same_as<int, SomeTemplate<void(Ts&&...)>>;
  }
void Foo();
```

clang-format gets confused and treats the parameter list of the function type like a fold _expression_ over logical and:

```c++
template <typename... Ts>
  requires requires {
 requires std::same_as<int, SomeTemplate<void(Ts && ...)>>;
  }
void Foo();
```

Note that this bug requires `requires requires` to be present to reproduce. Without it clang-format does the right thing (although I think it used to fail in the same way.)

```c++
template <typename... Ts>
 requires std::same_as<int, SomeTemplate<void(Ts&&...)>>
void Foo();
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to