-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang-format] clang-format Fails on Lambda with Parameter Pack, Reference Capture and Constraint in .h Header #61032
Comments
@llvm/issue-subscribers-clang-format |
Could you please try 16 or |
I tried 16.0.0rc3, and it seems to be fixed. Similar to #59522 and #57093, and fixed by 2476135? So here is another demo of #include <type_traits>
#include <utility>
void f(void)
{
int i = 3;
auto impl = [&i]<std::size_t... I>(std::index_sequence<I...>)
requires std::is_same_v<std::index_sequence<I...>, std::make_index_sequence<3>>
{
(I, ...);
};
} with the #include <type_traits>
#include <utility>
void f(void)
{
int i = 3;
auto impl = [&i]<typename... T>(std::tuple<T...> t)
requires (std::is_same_v<T, int> && ...)
{
std::get<0>(t);
};
} Clang-Format fails for this Again, removing reference capture, or change the extension to |
The issue here is that because of the ambiguous One possible workaround is to just not make the config being used language-specific, such as the following: BasedOnStyle: Microsoft
UseTab: Always |
Here is the minimal example:
.clang-format
:test.h
:when running
clang-format --style=file -i test.h
, Clang-Format would replace all the tab indentations with 4 spaces, evenUseTab
isAlways
; in fact, clang-format would neglect all given style option, except forBasedOnStyle
(which I am not sure).However, if change the extension to
.cpp
or.hpp
, Clang-Format would work fine.Without reference capture (say, with value capture only), this would also work fine.
Type parameter (
typename... T
) works fine too.The text was updated successfully, but these errors were encountered: