Closed
Description
clang-format
incorrectly formats methods declared with the trailing return type syntax followed by a requires
clause.
Tested version:
clang-format version 15.0.0 (https://github.com/llvm/llvm-project.git e8716179eb0b57ad6d767bb17f349f32f387c7bd)
Platform:
Arch Linux, x86_64
Consider this example:
template<typename T>
struct Foo
{
auto bar() -> int
requires(is_integral_v<T>)
{
call_something();
return 0;
}
};
Reformatting it with clang-format
(using the default configuration) leads to badly indented function body:
template <typename T> struct Foo {
auto bar() -> int requires(is_integral_v<T>) {
call_something();
return 0;
}
};
When using the regular return type syntax... :
template<typename T>
struct Foo
{
int bar()
requires(is_integral_v<T>)
{
call_something();
return 0;
}
};
... the method is formatted as expected:
template <typename T> struct Foo {
int bar()
requires(is_integral_v<T>)
{
call_something();
return 0;
}
};