[cfe-commits] r173514 - in /cfe/trunk: include/clang/Basic/TargetCXXABI.h include/clang/Basic/TargetInfo.h lib/AST/ASTContext.cpp lib/AST/RecordLayout.cpp lib/AST/RecordLayoutBuilder.cpp lib/AST/VTableBuilder.cpp lib/Basic/TargetInfo.cpp lib/Basic/Targets.cpp lib/CodeGen/CGClass.cpp lib/CodeGen/CGRecordLayoutBuilder.cpp lib/CodeGen/CodeGenModule.cpp lib/Sema/SemaType.cpp

John McCall rjmccall at apple.com
Tue Mar 12 17:39:53 PDT 2013


On Mar 12, 2013, at 3:33 PM, João Matos <ripzonetriton at gmail.com> wrote:
> On Fri, Jan 25, 2013 at 10:30 PM, John McCall <rjmccall at apple.com> wrote:
> -  // 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()
> 
> Hi John, this check prevents libraries like FastDelegates from being parsed in MSVC mode.
> 
> How hard is it to implement proper template instantiation like you explain in the comment?

Shouldn't be hard at all;  I'm pretty positive we have other places that
need exactly this.  Look at the other users of RequireCompleteType
and find some other place that wants a complete type if possible but
permits an incomplete type.  I think that happens in e.g. ADL and
overload resolution.

> Can this check be relaxed a bit meanwhile so Clang can parse libraries that make use of those forward declared member pointers?


Nah, just fix it.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130312/1c9db325/attachment.html>


More information about the cfe-commits mailing list