Index: lib/Sema/SemaChecking.cpp =================================================================== --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -12453,8 +12453,9 @@ MisalignedMember(Op)); if (MA != MisalignedMembers.end() && (T->isIntegerType() || - (T->isPointerType() && - Context.getTypeAlignInChars(T->getPointeeType()) <= MA->Alignment))) + (T->isPointerType() && (T->getPointeeType()->isIncompleteType() || + Context.getTypeAlignInChars( + T->getPointeeType()) <= MA->Alignment)))) MisalignedMembers.erase(MA); } } Index: test/SemaCXX/address-packed.cpp =================================================================== --- test/SemaCXX/address-packed.cpp +++ test/SemaCXX/address-packed.cpp @@ -112,3 +112,12 @@ S s3; s3.get(); // expected-note {{in instantiation of member function 'S::get'}} } + +// PR35509 +typedef long L1; +struct Incomplete; +struct S2 { + L1 d; + Incomplete *e() const; +} __attribute__((packed)); +Incomplete *S2::e() const { return (Incomplete *)&d; } // no-warning