[cfe-dev] Running clang over the C++ standard header <vector>

Douglas Gregor dgregor at apple.com
Wed Jun 10 06:34:54 PDT 2009


On Jun 10, 2009, at 3:16 AM, Eli Friedman wrote:

> I was curious how much trouble clang would have with <vector>
> considering current template work, so I tried it out; ignoring using
> declarations, I've managed to reduce the following issues, which I
> think are distinct from each other.

Thanks for doing this!

> Crash 1:
> template<class T> struct a { typedef int v; };
> template<class T, bool = a<T>::v> struct p { typedef double v; };

Hrm, this should work. I'll look into it.

> Crash 2:
> template<class T> struct a {};
> template<class T> T a<T>::x;

Known not to work; we haven't even started on out-of-line definitions  
of the members of templates.

> Crash 3:
> template<typename T> T a() { return typename T::x(); }

Known not to work; we haven't started work on function templates (

> Crash 4:
> template<class T> class Q;
> template<class T> class R : Q<Q<T> > {T current;};

Also a bug; I'll look into it.

> Parser error on valid code:
> struct a { template<class T> a(T) { T a; } };

As with Crash 3, we don't have function-template support, so we know  
this won't work.

> I'm not sure whether it's appropriate to file bugs for all of these at
> the moment...

Feel free to file bugs for crashes 1 and 4, because support for those  
features is mostly available now and the examples should work.

	- Doug



More information about the cfe-dev mailing list