Skip to content

[clang-format] clang-format Fails on Lambda with Parameter Pack, Reference Capture and Constraint in .h Header #61032

Closed as not planned
@kaigu1997

Description

@kaigu1997

Here is the minimal example:
.clang-format:

BasedOnStyle: Microsoft
---
Language: Cpp
UseTab: Always

test.h:

void f(void)
{
	int i = 3;
	auto impl = [&i]<int... I>()
	{
		(I, ...);
	};
}

when running clang-format --style=file -i test.h, Clang-Format would replace all the tab indentations with 4 spaces, even UseTab is Always; in fact, clang-format would neglect all given style option, except for BasedOnStyle (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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-formatobsoleteIssues with old (unsupported) versions of LLVM

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions