Skip to content

Bug: clang-format breaks function calls on user-defined-literals #60576

Closed
llvm/llvm-project-release-prs
#291
@liss-h

Description

Currently clang-format removes spaces after user-defined-literals when calling functions on them.
This makes code not compile anymore.

Clang Format version: clang-format version 15.0.7 (Fedora 15.0.7-1.fc37)

Example:
Before Formatting:

$ cat test.cpp

#include <chrono>
using namespace std::chrono_literals;

int main() { auto x = 5s .count() == 5; }

$ clang++ test.cpp && echo $?
0

After Formatting:

$ clang-format test.cpp > testfmt.cpp

$ cat testfmt.cpp

#include <chrono>
using namespace std::chrono_literals;

int main() { auto x = 5s.count() == 5; }

$ clang++ testfmt.cpp

testfmt.cpp:4:24: error: invalid suffix 's.count' on integer constant
int main() { auto x = 5s.count() == 5; }
                       ^
1 error generated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions