diff options
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 15 |
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(); |