diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 52ed28afb937..cc0aadeec29f 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -3436,7 +3436,7 @@ bool CheckRedundantInit(Sema &S, return false; } - if (FieldDecl *Field = Init->getMember()) + if (FieldDecl *Field = Init->getAnyMember()) S.Diag(Init->getSourceLocation(), diag::err_multiple_mem_initialization) << Field->getDeclName() diff --git a/clang/test/SemaCXX/class-base-member-init.cpp b/clang/test/SemaCXX/class-base-member-init.cpp index e84e57b7471b..2cdca829ffb9 100644 --- a/clang/test/SemaCXX/class-base-member-init.cpp +++ b/clang/test/SemaCXX/class-base-member-init.cpp @@ -90,3 +90,11 @@ namespace test5 { } }; } + +namespace rdar13185264 { + class X { + X() : a(), // expected-note{{previous initialization is here}} + a() { } // expected-error{{multiple initializations given for non-static member 'a'}} + union { void *a; }; + }; +}