Spaces between type and variable name in IIFE lambda in brace init removed by formatter #44292
Labels
bug
Indicates an unexpected problem or unintended behavior
bugzilla
Issues migrated from bugzilla
clang-format
confirmed
Verified by a second party
invalid-code-generation
Tool (e.g. clang-format) produced invalid code that no longer compiles
Extended Description
The following code
is formatted into
by clang-format-9 when using -style="{AlignConsecutiveDeclarations: true, Cpp11BracedListStyle: false}".
The resulting code no longer compiles - note the missing space between
int
and the variable name.Changing either formatting option will fix the problem, it's the combination that leads to the erroneous output.
The code is also correctly formatted if the outer braces (initialization of foo) are replaced by a
=
assignment.I don't have a later clang-format version than 9 installed locally, but trying this code snippet in https://zed0.co.uk/clang-format-configurator with 10.0.0+b452de0 and these two formatting options, the output suddenly gets blank (-> crash?).
The text was updated successfully, but these errors were encountered: