Handle classes with default constructors that are defaulted or are not
present in the AST.
Classes with virtual methods or virtual bases are not trivially
default constructible, so their members and bases need to be initialized.
Details
- Reviewers
aaron.ballman alexfh omtcyfz
Diff Detail
- Build Status
Buildable 124 Build 124: arc lint + arc unit
Event Timeline
clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp | ||
---|---|---|
307 | Please add an explanatory string literal to the assert (that way, if it triggers, some more information is immediately available). | |
372–374 | Should also update the comment. | |
test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp | ||
401 | Can you also add a test like: template <typename T> struct S { T Val; virtual ~S() = default; }; template struct S<int>; |
Don't match template instantiations.
Add assert message.
Update macro comment.
Add tests for templates and macros.
Generally looks good to me, sorry I missed these tiny nits last time around.
clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.h | ||
---|---|---|
49 | Since this is not allowed to be a null pointer, would it make more sense to use a reference instead (same below)? | |
test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp | ||
409 | Sorry, I missed one bit to my test (my fault), can you also add int F; to ensure that it still triggers the diagnostic? |
Since this is not allowed to be a null pointer, would it make more sense to use a reference instead (same below)?