Skip to content

[clang-format] Excess characters in a line when formatting of BlockIndent. #59567

@red1bluelost

Description

@red1bluelost

Using the following config on the below code does not properly break the code into BlockIndent as it should. The static_assert line is formatted to exceed 80 character column limit.

From toying around, I noticed that if I changed the angle brackets (<, >) into parenthesis ((, )), the line is formatted correctly.

---
Language:                                  Cpp
AlignAfterOpenBracket:                     BlockIndent
ColumnLimit:                               80
...
#include <iterator>
#include <type_traits>

template <typename Category> struct S {
  static_assert(std::is_base_of_v<std::output_iterator_tag, Category> || std::is_base_of_v<std::input_iterator_tag, Category>);
};

The correct formatting would be:

  static_assert(
    std::is_base_of_v<std::output_iterator_tag, Category> ||
    std::is_base_of_v<std::input_iterator_tag, Category>
  );

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions