File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -402,6 +402,8 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
402
402
// Gather all fields (direct and indirect) that need to be initialized.
403
403
SmallPtrSet<const FieldDecl *, 16 > FieldsToInit;
404
404
forEachField (ClassDecl, ClassDecl.fields (), [&](const FieldDecl *F) {
405
+ if (IgnoreArrays && F->getType ()->isArrayType ())
406
+ return ;
405
407
if (!F->hasInClassInitializer () &&
406
408
utils::type_traits::isTriviallyDefaultConstructible (F->getType (),
407
409
Context) &&
Original file line number Diff line number Diff line change
1
+ // RUN: %check_clang_tidy %s \
2
+ // RUN: cppcoreguidelines-pro-type-member-init %t \
3
+ // RUN: -config="{CheckOptions: \
4
+ // RUN: [{key: cppcoreguidelines-pro-type-member-init.IgnoreArrays, value: true} ]}"
5
+
6
+ typedef int TypedefArray[4 ];
7
+ using UsingArray = int [4 ];
8
+
9
+ struct HasArrayMember {
10
+ HasArrayMember () {}
11
+ // CHECK-MESSAGES: warning: constructor does not initialize these fields: Number
12
+ UsingArray U;
13
+ TypedefArray T;
14
+ int RawArray[4 ];
15
+ int Number;
16
+ };
You can’t perform that action at this time.
0 commit comments