Issue 148289
Summary [clang-tidy] `readability-redundant-inline-specifier`: with modules, `inline` on in-class member function definitions is not always redundant
Labels clang-tidy
Assignees
Reporter localspook
    Consider this class:
```cpp
struct s {
    void f() {}
};
```
In a non-module world, `f` is implicitly `inline`, and writing the keyword is redundant.
But C++20 adopted [P1779](wg21.link/p1779), which changes the semantics of this code: when `s` is not attached to the global module, `f` is not `inline`; if you want it to be, you have to say so explicitly. This does not apply to defaulted member functions however:
```cpp
struct s {
    inline s() = default; // Still redundant.
};
```
So I believe this check should not trigger outside the global module and when the function isn't defaulted. (We may even want to add a check like `modernize-modules` that *adds* `inline` to ease the transition to modules.)

Godbolt: https://godbolt.org/z/Gv9YGzq9e
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to