aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2013-01-25 22:30:49 +0000
committerJohn McCall <rjmccall@apple.com>2013-01-25 22:30:49 +0000
commitb8b2c9da87e7d70a1679db026f40548b3192b705 (patch)
treefaa4fbe6a64798098a71a21c89b2efc392f393e5 /lib/Sema/SemaType.cpp
parentd07865b42dcb32154c75134fded51b38cc55a0c4 (diff)
First pass at abstracting out a class for the target C++ ABI.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index f6cad26989..4819363f27 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1667,11 +1667,16 @@ QualType Sema::BuildMemberPointerType(QualType T, QualType Class,
return QualType();
}
- // In the Microsoft ABI, the class is allowed to be an incomplete
- // type. In such cases, the compiler makes a worst-case assumption.
- // We make no such assumption right now, so emit an error if the
- // class isn't a complete type.
- if (Context.getTargetInfo().getCXXABI() == CXXABI_Microsoft &&
+ // C++ allows the class type in a member pointer to be an incomplete type.
+ // In the Microsoft ABI, the size of the member pointer can vary
+ // according to the class type, which means that we really need a
+ // complete type if possible, which means we need to instantiate templates.
+ //
+ // For now, just require a complete type, which will instantiate
+ // templates. This will also error if the type is just forward-declared,
+ // which is a bug, but it's a bug that saves us from dealing with some
+ // complexities at the moment.
+ if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
RequireCompleteType(Loc, Class, diag::err_incomplete_type))
return QualType();