[clang-tools-extra] [clang-tidy] detect explicit casting within modernize-use-default-member-init (PR #129408)
David Rivera via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 11 10:21:13 PDT 2025
RiverDave wrote:
> Change looks correct, but looks like this check got one more limitation in case of code like this:
>
> ```
> class CastInit {
> CastInit() : m(static_cast<int>(9)) {}
> int m = 9;
> };
> ```
>
> And this:
>
> ```
> class CastInit {
> CastInit() : m(static_cast<int>(0)) {}
> int m {};
> };
> ```
> Change looks correct, but looks like this check got one more limitation in case of code like this:
>
> ```
> class CastInit {
> CastInit() : m(static_cast<int>(9)) {}
> int m = 9;
> };
> ```
>
> And this:
>
> ```
> class CastInit {
> CastInit() : m(static_cast<int>(0)) {}
> int m {};
> };
> ```
Hadn't thought of this, but your idea makes sense, I'll try to implement it.
https://github.com/llvm/llvm-project/pull/129408
More information about the cfe-commits
mailing list