Skip to content

modernize-use-trailing-return-type reports underlying type in fix-it for lamdba #144510

Open
@firewave

Description

@firewave
#include <algorithm>
#include <cstddef>

void f()
{
    auto val = [](size_t m) {
        size_t a = 0;
        return std::max(m, a);
    };
}
<source>:6:16: warning: use a trailing return type for this lambda [modernize-use-trailing-return-type]
    6 |     auto val = [](size_t m) {
      |                ^
      |                             -> unsigned long

https://godbolt.org/z/9K4M7Mz8E

It should be reporting size_t instead. It seems to be related to the template call involved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions