Skip to content

[clang-format] Single-quote separator from C23 leads to wrong formatting #158413

@goekce

Description

@goekce
clang-format version 22.0.0 (/build/llvm-git/llvm-project cdd54ff927e0207a3e65bade576e3c2511112953)

test.c:

char data = 0b1000'0110; // Single quotation mark for better readability

int main(void) {
  return 0;
}

clang-format test.c results in:

char data = 0b1000'0110; // Single quotation mark for better readability

    int
    main(void) { // <= expectation: `int main...`
  return 0;
}

according to clangd/clangd#2485 (comment), this is a regression in clang-format 20 compared to clang-format 19.

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions