Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[clang-format] mistaking reference for binary operator in macro with clang-format 19 #100304

Copy link
Copy link
Closed
@rmarker

Description

@rmarker
Issue body actions

While trying out clang-format on the new 19.x branch, I discovered an issue with the formatting in macros.
It is incorrectly treating the rvalue reference as a binary operator.

In clang-format 18.1.7 with the default LLVM style:

#define RVALUE_COPY(CLASS)                                                     \
  CLASS(CLASS &&That) : my(std::move(That.my)) {}

In clang-format 19.1.0 (183e8ec)

#define RVALUE_COPY(CLASS)                                                     \
  CLASS(CLASS && That) : my(std::move(That.my)) {}

I also discovered that a similar thing happens with * and & as well. I.e.

#define PTR_COPY(CLASS)                                                     \
  CLASS(CLASS * That) : my(That->my) {}
#define REF_COPY(CLASS)                                                     \
  CLASS(CLASS & That) : my(That.my) {}

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done
Show more project fields

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.