This fixes https://llvm.org/bugs/show_bug.cgi?id=30487 where
warning: uninitialized record type: 's' [cppcoreguidelines-pro-type-member-init]
is emitted on
struct MyStruct { int a = 5; int b = 7; }; int main() { MyStruct s; }
Differential D24848
[clang-tidy] fix false-positive for cppcoreguidelines-pro-type-member-init with in-class initializers mgehre on Sep 22 2016, 2:45 PM. Authored by
Details
This fixes https://llvm.org/bugs/show_bug.cgi?id=30487 where warning: uninitialized record type: 's' [cppcoreguidelines-pro-type-member-init] is emitted on struct MyStruct { int a = 5; int b = 7; }; int main() { MyStruct s; }
Diff Detail Event Timeline
Comment Actions Rename the struct that was introduced in the test. Note that I need to keep the function Bug30487, Comment Actions D24965 will allow you to write a positive test instead: struct PositivePartiallyInClassInitialized { // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: constructor does not initialize these fields: G int F = 0; int G; // CHECK-FIXES: int G{}; }; Comment Actions I would like to close that particular bug report, and thus I would like to have the reproducer of that bug as part of the test case. Are you okay with me committing this as it currently is? |
There's already this test:
I'd call your test NegativeInClassInitializedImplicit, and also add this: