Index: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp =================================================================== --- clang-tidy/modernize/UseDefaultMemberInitCheck.cpp +++ clang-tidy/modernize/UseDefaultMemberInitCheck.cpp @@ -273,7 +273,7 @@ void UseDefaultMemberInitCheck::checkExistingInit( const MatchFinder::MatchResult &Result, const CXXCtorInitializer *Init) { - const FieldDecl *Field = Init->getMember(); + const FieldDecl *Field = Init->getAnyMember(); if (!sameValue(Field->getInClassInitializer(), Init->getInit())) return; Index: test/clang-tidy/modernize-use-default-member-init.cpp =================================================================== --- test/clang-tidy/modernize-use-default-member-init.cpp +++ test/clang-tidy/modernize-use-default-member-init.cpp @@ -382,6 +382,16 @@ const char *e4 = "bar"; }; +struct UnionExisting { + UnionExisting() : e(5.0) {} + // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: member initializer for 'e' is redundant + // CHECK-FIXES: UnionExisting() {} + union { + int i; + double e = 5.0; + }; +}; + template struct NegativeTemplateExisting { NegativeTemplateExisting(int) : t(0) {}