diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability')
| -rw-r--r-- | clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp index 6d3650059d4..8409f9f40d2 100644 --- a/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp @@ -39,7 +39,8 @@ void RedundantMemberInitCheck::registerMatchers(MatchFinder *Finder) { forEachConstructorInitializer( cxxCtorInitializer(isWritten(), withInitializer(ignoringImplicit(Construct)), - unless(forField(hasType(isConstQualified())))) + unless(forField(hasType(isConstQualified()))), + unless(forField(hasParent(recordDecl(isUnion()))))) .bind("init"))), this); } @@ -52,7 +53,7 @@ void RedundantMemberInitCheck::check(const MatchFinder::MatchResult &Result) { Construct->getArg(0)->isDefaultArgument()) { if (Init->isAnyMemberInitializer()) { diag(Init->getSourceLocation(), "initializer for member %0 is redundant") - << Init->getMember() + << Init->getAnyMember() << FixItHint::CreateRemoval(Init->getSourceRange()); } else { diag(Init->getSourceLocation(), |

