Skip to content

[clang-format]: Inserts a space after u8 string literal modifiers in C: u8"My utf-8 string" -> u8 "My utf-8 string" and breaks compilation #134453

@WillAvudim

Description

@WillAvudim

It worked with clang-format-17 just fine. After upgrading to clang-format-21 (latest dev as of April 4th 2025), it started inserting spaces between string literal type and the rest of the literal.
WAS: u8"My UTF-8 string"
BECOMES: u8 "My UTF-8 string"

Needless to say that this breaks compilation.

It's weird that it still works in C++ just fine, only C is broken.

I played with all the configuration parameters that could be related but couldn't find anything fixing this. Reverting all settings to an empty (default) configuration and trying various defaults doesn't help either: it's broken disregarding the defaults or any other settings.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions