This is a fix for PR35509 in which we crash because we attempt to compute the
alignment of an incomplete type.
Differential Revision: https://reviews.llvm.org/D40895
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320017
91177308-0d34-0410-b5e6-
96231b3b80d8
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);
}
}
S<float> s3;
s3.get(); // expected-note {{in instantiation of member function 'S<float>::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