Skip to content

modernize-use-trailing-return-type might show desugared type in fix-it hint for lamdba #144585

Open
@firewave

Description

@firewave

Split from #144509.

#include <algorithm>
#include <vector>

void f()
{
    auto it2 = [](const std::vector<int>& v) {
        return std::find_if(v.cbegin(), v.cend(), [](int i) -> bool {
            return i == 0;
        });
    };
}
<source>:10:16: warning: use a trailing return type for this lambda [modernize-use-trailing-return-type]
   10 |     auto it2 = [](const std::vector<int>& v) {
      |                ^
      |                                              -> __gnu_cxx::__normal_iterator<const int *, std::vector<int>>

https://godbolt.org/z/zzYMa4o5r

It should be suggesting std::vector<int>::const_iterator.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions