On Mar 12, 2013, at 3:33 PM, João Matos <[email protected]> wrote:
> On Fri, Jan 25, 2013 at 10:30 PM, John McCall <[email protected]> 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.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to