diff options
author | Reid Kleckner <reid@kleckner.net> | 2013-03-28 22:15:11 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2013-03-28 22:15:11 +0000 |
commit | 4bbae38abf4145b81a3bf8658968fdaa2a8941c1 (patch) | |
tree | 6673cd13da395f588bd0e75f2873d5fdfb3149f5 /lib/Sema/SemaType.cpp | |
parent | 59d8ccb45eeb33d255fd39933e75b45770a7a009 (diff) |
[sema] Check the result of getAsCXXRecordDecl() to fix the build
I'm not 100% sure what should happen here to find the real
CXXRecordDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178297 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index cbd8c31fa7..06004bd00c 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -1733,12 +1733,12 @@ QualType Sema::BuildMemberPointerType(QualType T, QualType Class, // when passing pointers between TUs that disagree about the size. if (Context.getTargetInfo().getCXXABI().isMicrosoft()) { CXXRecordDecl *RD = Class->getAsCXXRecordDecl(); - if (!RD->hasAttr<MSInheritanceAttr>()) { + if (!RD || !RD->hasAttr<MSInheritanceAttr>()) { // Lock in the inheritance model on the first use of a member pointer. // Otherwise we may disagree about the size at different points in the TU. // FIXME: MSVC picks a model on the first use that needs to know the size, // rather than on the first mention of the type, e.g. typedefs. - if (RequireCompleteType(Loc, Class, 0) && !RD->isBeingDefined()) { + if (RequireCompleteType(Loc, Class, 0) && RD && !RD->isBeingDefined()) { // We know it doesn't have an attribute and it's incomplete, so use the // unspecified inheritance model. If we're in the record body, we can // figure out the inheritance model. |