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(
119119void UseDesignatedInitializersCheck::registerMatchers (MatchFinder *Finder) {
120120 const auto HasBaseWithFields =
121121 hasAnyBase (hasType (cxxRecordDecl (has (fieldDecl ()))));
122+
123+ // see #133715
124+ const auto IsSTLArray =
125+ hasType (qualType (hasDeclaration (recordDecl (hasName (" ::std::array" )))));
126+
122127 Finder->addMatcher (
123128 initListExpr (
124129 hasType (cxxRecordDecl (RestrictToPODTypes ? isPOD () : isAggregate (),
125130 unless (HasBaseWithFields))
126131 .bind (" type" )),
127132 IgnoreSingleElementAggregates ? hasMoreThanOneElement () : anything (),
128- unless (isFullyDesignated ()))
133+ unless (anyOf ( isFullyDesignated (), IsSTLArray )))
129134 .bind (" init" ),
130135 this );
131136}
Original file line number Diff line number Diff line change @@ -182,6 +182,10 @@ Changes in existing checks
182182 ``constexpr `` and ``static` `` values on member initialization and by detecting
183183 explicit casting of built-in types within member list initialization.
184184
185+ - Improved :doc: `modernize-use-designated-initializers
186+ <clang-tidy/checks/modernize/use-designated-initializers>` check by avoiding
187+ diagnosing designated initializers for ``std::array `` initializations.
188+
185189- Improved :doc: `modernize-use-ranges
186190 <clang-tidy/checks/modernize/use-ranges>` check by updating suppress
187191 warnings logic for ``nullptr `` in ``std::find ``.
You can’t perform that action at this time.
0 commit comments