[cfe-dev] New C++0x feature support in Clang

Howard Hinnant hhinnant at apple.com
Wed Jan 26 16:27:39 PST 2011


On Jan 26, 2011, at 6:22 PM, Jean-Daniel Dupas wrote:

> 
> Le 26 janv. 2011 à 22:45, Douglas Gregor a écrit :
> 
>> Clang has recently gotten much-improved support for the upcoming C++0x standard. In particular, top-of-tree Clang now supports a number of C++0x features:
>> 
>> 	- Rvalue references (including rvalue references for *this)
>> 	- Variadic templates
>> 	- Inline namespaces
>> 	- Late-specified return types
>> 	- Decltype
>> 
>> You can turn on C++0x support with the -std=gnu++0x (or, if you want to be more pedantic, -std=c++0x).
>> 
>> Give it a spin, write some tests, try it out with libc++, and tell us how it went! And if you get the itch to hack on Clang, there are a ton of other little C++0x features that you could implement.
>> 
> 
> A quick reminder about "How to use libc++ with clang" will be welcome at this point ;-)

It depends on the platform.  On OS X 10.6, download this library:

http://home.roadrunner.com/~hinnant/libcppabi.zip

and copy it into /usr/lib .

This is a low-level library that takes care of things like typeinfo and exception propagation.  Once that is taken care of:

$ clang++ -stdlib=libc++ test.cpp

This will assume that /usr/lib/libc++.dylib exists.  And the libc++ headers should be installed at /usr/include/c++/v1/ .

If you need to build libc++.dylib, cd into libcxx/lib and execute ./buildit .

I have no experience on running libc++ on other platforms.

-Howard





More information about the cfe-dev mailing list