[cfe-dev] unknown type name __thiscall

Douglas Gregor dgregor at apple.com
Tue Mar 16 14:48:48 PDT 2010


On Mar 16, 2010, at 2:28 PM, Stephen Deken wrote:

> Hello list,
> 
> I'm getting strange errors emitted by clang++ on Windows 7 (built
> using Visual Studio 9 from trunk) when attempting to compile C++ code
> that includes the VC9 headers:
> 
> cfetest.cpp:
> 
> 	#include <iostream>
> 	using namespace std;
> 	int main( int, char** ) {
> 		cout <<"hello world!" <<endl;
> 		return 0;
> 	}
> 
> This emits 122 errors.  Some are about __thiscall, which clang/clang++
> apparently doesn't define,

No, we don't define that. We could (and probably should).

> others are related to MS-specific
> extensions such as __is_base_of

These are also extension that we could probably support under -fms-extensions. I, personally, don't have strong motivation to implement them, but of course we'll be happy to review patches.

> , or improper typedefs within
> templates, or delete[]ing void pointers, etc.
> 
> Basically, it's rubbish :)

Visual C++ accepts a lot of ill-formed code, especially in templates. Teaching Clang's parser to work around those problems will be a trying experience. For reference, the author of GCC-XML dealt with this problem with GCC by patching the headers. It might be worthwhile to see what he had to do:

	http://www.gccxml.org/HTML/Index.html

> I didn't expect it to be able to emit code (I'm only really interested
> in the semantic analysis), but I can't do that if the system headers
> barf errors all over the place.  Am I doing something wrong with my
> setup, or is it expected that trying to use Visual Studio's C++
> headers is a Bad Idea?


I've never tried it, but I do know that the headers Microsoft ships are far from well-formed C++, so this is probably the expected behavior given that Clang is a picky compiler when it comes to standards conformance.

	- Doug



More information about the cfe-dev mailing list