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

Howard Hinnant hhinnant at apple.com
Thu Jan 27 06:49:43 PST 2011


On Jan 27, 2011, at 9:45 AM, İsmail Dönmez wrote:

> Hi;
> 
> On Thu, Jan 27, 2011 at 4:42 PM, Howard Hinnant <hhinnant at apple.com> wrote:
> On Jan 27, 2011, at 3:59 AM, İsmail Dönmez wrote:
> 
> > Hi;
> >
> > On Thu, Jan 27, 2011 at 2:27 AM, Howard Hinnant <hhinnant at apple.com> wrote:
> >
> > 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/ .
> >
> > I tried to build on OSX 10.6 and looks like there is a problem with c++ includes:
> >
> > + for FILE in '../src/*.cpp'
> > + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/condition_variable.cpp
> > ../src/condition_variable.cpp:15:1: warning: inline namespaces are a C++0x feature [-Wc++0x-extensions]
> > _LIBCPP_BEGIN_NAMESPACE_STD
> > ^
> > In file included from ../src/condition_variable.cpp:10:
> > In file included from ../include/condition_variable:110:
> > ../include/__config:151:52: note: instantiated from:
> > #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
> >                                                    ^
> > 1 warning generated.
> > + for FILE in '../src/*.cpp'
> > + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/exception.cpp
> > ../src/exception.cpp:14:12: fatal error: 'cxxabi.h' file not found
> >   #include <cxxabi.h>
> >            ^
> > 1 error generated.
> >
> > Regards,
> > ismail
> >
> 
> Sorry, I forgot a step:
> 
> $ export TRIPLE=-apple-
> 
> before you ./buildit.
> 
> Tried;
> 
> TRIPLE=x86_64-apple-darwin10 ./buildit
> 
> and
> 
> TRIPLE=i386-apple-darwin10 ./buildit
>  
> but it still can't find cxxabi.h.

Sorry, I promise this will get better.  Place this:

http://home.roadrunner.com/~hinnant/cxxabi.h

in /usr/include

-Howard





More information about the cfe-dev mailing list