Skip to content

[clang-tidy] Check request: modernize-use-auto-temporary #145798

@denzor200

Description

@denzor200

C++23 suggests us the way to make a temporary copy of an object without creating a variable.
Need a check that fill find places in the code that mignt be improved using this new feature and will provide fixit hint to change that.

BEFORE:

void example(const auto& arg) {
  const auto copy = get();
  process(copy);
  process(std::decay_t<decltype(arg)>{arg});
}

AFTER:

void example(const auto& arg) {
  process(auto{copy});
  process(auto{arg});
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions