[cfe-dev] CLang compiling windows.h from the Windows SDK

Jesse Towner townerj at gmail.com
Sun Aug 8 15:47:49 PDT 2010


Yeah, MSVC++ doesn't treat static_cast as a template, but if you look at
the function that has the static_cast<IUnknown*>(p) expression, the
function itself is a template, and IUnknown even though it's not a
dependent type of the template doesn't have it's name resolved until the
template function is instantiated in MSVC++.

On Sun, 2010-08-08 at 16:38 -0600, Sean Hunt wrote:
> On 08/08/2010 04:13 PM, Christopher Jefferson wrote:
> > It is truly undeclared, this is due to windows being lax on what it accepts in templates. However, with some careful consideration, clang could possibly consider making it a magic type, if there is only a very small number of such hacks required to parse windows.h. I haven't done a careful analysis of how many such examples there are.
> >
> > Chris
> 
> static_cast isn't a template, it's an operator. Does MSVC accept 
> "IUnknown * i;" or "static_cast <foo*>(ptr)" when IUnknown and foo 
> haven't been declared?
> 
> Sean
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list