Strange formatting of a requires containing an array #53864
Closed
Description
I tested with clang-format after https://reviews.llvm.org/D113319 landed and found some issues in new code. This looks similar to #53820, but I'm not sure whether it's the same issue.
I used this config
BasedOnStyle: LLVM
---
Language: Cpp
Standard: c++20
Code (for libc++ so uses __ugly_names)
template <class _Context, class _Tp>
requires is_array_v<_Tp> &&
same_as<_Tp, typename _Context::char_type[extent_v<_Tp>
]> consteval auto
__make_storage_type() {
return __storage_type<basic_string_view<typename _Context::char_type>>{};
}
I would expect this part to be on one line same_as<_Tp, typename _Context::char_type[extent_v<_Tp>]>
Using parens solves the issue
template <class _Context, class _Tp>
requires(is_array_v<_Tp> &&
same_as<_Tp, typename _Context::char_type[extent_v<_Tp>]>)
consteval auto __make_storage_type() {
return __storage_type<basic_string_view<typename _Context::char_type>>{};
}
Activity