File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -119,13 +119,18 @@ UseDesignatedInitializersCheck::UseDesignatedInitializersCheck(
119
119
void UseDesignatedInitializersCheck::registerMatchers (MatchFinder *Finder) {
120
120
const auto HasBaseWithFields =
121
121
hasAnyBase (hasType (cxxRecordDecl (has (fieldDecl ()))));
122
+
123
+ // see #133715
124
+ const auto IsSTLArray =
125
+ hasType (qualType (hasDeclaration (recordDecl (hasName (" ::std::array" )))));
126
+
122
127
Finder->addMatcher (
123
128
initListExpr (
124
129
hasType (cxxRecordDecl (RestrictToPODTypes ? isPOD () : isAggregate (),
125
130
unless (HasBaseWithFields))
126
131
.bind (" type" )),
127
132
IgnoreSingleElementAggregates ? hasMoreThanOneElement () : anything (),
128
- unless (isFullyDesignated ()))
133
+ unless (anyOf ( isFullyDesignated (), IsSTLArray )))
129
134
.bind (" init" ),
130
135
this );
131
136
}
Original file line number Diff line number Diff line change @@ -171,6 +171,10 @@ Changes in existing checks
171
171
``constexpr `` and ``static` `` values on member initialization and by detecting
172
172
explicit casting of built-in types within member list initialization.
173
173
174
+ - Improved :doc: `modernize-use-designated-initializers
175
+ <clang-tidy/checks/modernize/use-designated-initializers>` check by avoiding
176
+ diagnosing designated initializers for ``std::array `` initializations.
177
+
174
178
- Improved :doc: `modernize-use-ranges
175
179
<clang-tidy/checks/modernize/use-ranges>` check by updating suppress
176
180
warnings logic for ``nullptr `` in ``std::find ``.
You can’t perform that action at this time.
0 commit comments