Issue 146612
Summary [clang-tidy] Check request: bugprone-avoid-inline-constexpr-in-Implementations
Labels clang-tidy
Assignees
Reporter denzor200
    C++17 suggests us the possibility to use `inline` on `constexpr` variables, but when identical `inline constexpr` variables are defined in different translation units with different values, this violates the One Definition Rule (ODR) which manifests unpredictably (e.g., different values in different TUs).
Need a check to get rid from `inline` keyword on `constexpr` variables in source files.

BEFORE:
```
// foo.cpp
inline constexpr int MAX_SIZE = 1024;
```

AFTER:
```
// foo.cpp
constexpr int MAX_SIZE = 1024;
```

**Scope**
- Applies only to sources (.cpp, .cxx, etc.), ignoring .h files.

**Why `bugprone-`?**
- Runtime behaviour potentially affected due to unexpected constant's value selected in link time.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to