[cfe-dev] <vector> parse but cannot be instanciated

Douglas Gregor dgregor at apple.com
Wed Sep 16 08:55:42 PDT 2009


On Sep 16, 2009, at 1:28 AM, Cédric Venet wrote:

> Hi,
>
> I tried to compile my simple test:
>
> #define __declspec
> #include <vector>
>
> int main() {
> std::vector<int> v;
> return 0;
> }
>
> and for the first time the include of <vector> work (ie no parsing  
> error), good.

Yes, we're able to parse a bunch of libstdc++ headers now without  
spurious errors, but (as you've seen) we're a long way from being able  
to handle C++ programs.

> (note that I am using clang on windows with the mingw 3.4.5 headers  
> and that the define __declspec is needed. perhaps it should be added  
> to  the predefined macro? as clang support the dllimport attribute)

We have some support for parsing __declspec already, but I'm sure that  
we're missing it when parsing some C++ constructs. What kinds of  
problems are you seeing with __declspec?

> now, the instanciation of the vector assert:
>
> Assertion failed: false && "Unable to find declaration for the  
> current instantiation", file ..\..\..\..\..\tools\clang\lib\Sema 
> \SemaTemplateInstantiateDecl.cpp, line 1411


FWIW, this is coming from an attempt to instantiate a default argument  
expression in a template (that refers to a typedef), e.g.,

template<typename T>
struct X1 {
   typedef T value_type;
   X1(const value_type& value = value_type());
};

void test_X1() {
   X1<int> x1;
}

I should have a fix soon.

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090916/ef71c22b/attachment.html>


More information about the cfe-dev mailing list