File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -48,12 +48,19 @@ AST_MATCHER(InitListExpr, isFullyDesignated) {
48
48
}
49
49
50
50
AST_MATCHER (InitListExpr, hasSingleElement) { return Node.getNumInits () == 1 ; }
51
+
52
+ AST_MATCHER_FUNCTION (::internal::Matcher<CXXRecordDecl>, hasBaseWithFields) {
53
+ return hasAnyBase (hasType (cxxRecordDecl (has (fieldDecl ()))));
54
+ }
55
+
51
56
void UseDesignatedInitializersCheck::registerMatchers (MatchFinder *Finder) {
52
57
Finder->addMatcher (
53
- initListExpr (hasType (cxxRecordDecl (isAggregate ()).bind (" type" )),
54
- unless (IgnoreSingleElementAggregates ? hasSingleElement ()
55
- : unless (anything ())),
56
- unless (isFullyDesignated ()))
58
+ initListExpr (
59
+ hasType (cxxRecordDecl (isAggregate (), unless (hasBaseWithFields ()))
60
+ .bind (" type" )),
61
+ unless (IgnoreSingleElementAggregates ? hasSingleElement ()
62
+ : unless (anything ())),
63
+ unless (isFullyDesignated ()))
57
64
.bind (" init" ),
58
65
this );
59
66
}
Original file line number Diff line number Diff line change @@ -57,3 +57,7 @@ S2 s26 = template1<S2>();
57
57
template <typename S> S template2 () { return {}; }
58
58
59
59
S2 s27 = template2<S2>();
60
+
61
+ struct S5 : S2 { int x, y; };
62
+
63
+ S5 s51 {1 , 2 , .x = 3 , .y = 4 };
You can’t perform that action at this time.
0 commit comments