<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/106709>106709</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            In clang-tidy automated fix `modernize-use-trailing-return-type` should be applied after `readability-make-member-function-const`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          srpgilles
      </td>
    </tr>
</table>

<pre>
    I wrote for a quick lecture to introduce clang-tidy to my colleagues a faulty C++ snippet upon which I intended to run clang-tidy:

```c++
#include <iostream>

class Circle
{

    public:

    Circle(double radius);

 double ComputeArea();

    double radius_;
};


Circle::Circle(double radius)
{
    radius_ = radius;
}

double Circle::ComputeArea()
{
    return 3.14159 * radius_ * radius_;
}



int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
{
    Circle circle(2);

 std::cout << "Area of circle is " << circle.ComputeArea() << std::endl;

    return 0;
}
```

I discovered however on this simple example that `modernize-use-trailing-return-type` and `readability-make-member-function-const` are at odds:

```shell
clang-tidy main.cpp --fix -checks="-*,modernize-use-trailing-return-type,readability-make-member-function-const" -- -Weverything  -std=c++20 -x c++ 
```

will yield for `ComputeArea()` the signature:

```c++
auto ComputeArea() -> double const;
```

which is not what is intended (and of course `clang-tidy` still complains about the missing `const`).


There are of course workarounds if we want the two checks enabled:

- Run the `clang-tidy` command fix twice. We end up with

```c++
auto ComputeArea() const -> double const;
```

which is a bit more bloated that it should be (and trigger the compiler warning `clang-diagnostic-ignored-qualifiers`).

- Run the `clang-tidy` first without the `modernize-use-trailing-return-type`, and then run it with this check.


It would be better of course if this was handled properly automatically, hence this ticket!






</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVktv2zgQ_jX0ZSBDpmzFPviQ2A2Q62KBHguKHEuzoUiVj6jeX7-gHonaOEW2QEDF5Dy_b_hJ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