Skip to content

[clang-format] RemoveParentheses RPS_MultipleParentheses removes parentheses for parameter pack expansion #118142

@vaijns

Description

@vaijns

When having RemoveParentheses on RPS_MultipleParentheses it removes parentheses around parameter pack expansions e.g. in a static_assert():

template<bool... Values>
bool test(){
	static_assert((Values && ...));
	return true;
}

int main(){
	test<true, true, true, true>();
}

replaces the static_assert with static_assert(Values && ...); which doesn't compile because you have to add the extra parentheses when expanding the parameter pack.

I know that it says setting RemoveParentheses to anything else than Leave can lead to incorrect code but still though I'd report it, maybe it's possible to detect the parameter pack expansion and leave the parentheses in this case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions