[cfe-dev] New C++0x feature support in Clang
Christopher Jefferson
chris at bubblescope.net
Sun Jan 30 03:25:51 PST 2011
On 29 Jan 2011, at 19:13, Larry Evans wrote:
> On 01/29/11 05:16, Larry Evans wrote:
>> On 01/26/11 15:45, Douglas Gregor wrote:
>>> 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!
>>
>> Thanks Doug.
>>
>> It worked fine with:
>>
>> template<typename... T>
>> struct A
>> {
>> static unsigned const size=sizeof...(T);
>> };
>>
>> int main(void)
>> {
>> return A<int,int,int>::size;
>> }
>>
> Just #including iostream causes problems, as shown by
> compile of the following test.cpp:
>
> #include <iostream>
> int main(void)
> {
> std::cout<<"Hello World!\n";
> return 0;
> }
The problem you are seeing is that adding -std=c++0x adds a bunch of new g++-specific extensions to libstdc++ (the g++ standard library implementation). To make clang work on linux these all need supporting (or libc++ needs porting over).
Chris
More information about the cfe-dev
mailing list