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

Larry Evans cppljevans at suddenlink.net
Mon Jan 31 10:39:09 PST 2011


On 01/31/11 09:44, 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! And if you get the itch to hack on Clang, there are a ton of other little C++0x features that you could implement.
>>
>> 	Cheers,
>> 	Doug
> 
> The attached doesn't compile with clang++
> no matter what the value of macro, VAR_INIT_LIST.
> However, with g++, it does compile when:
>   VAR_INIT_LIST == 0
> 
> Is this a clang++ bug?
> 
> The following is the output from make showing
> the failure of clang++ to compile no matter what
> the macro value:
> 
>> make HOW=clangxx ud
>> for UD in 0 1 ; do \
>>           echo "{UD=" $UD ; \
>>           /home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang++ -c -std=c++0x -U__GXX_EXPERIMENTAL_CXX0X__ -c -DVAR_INIT_LIST=$UD var_init.cpp ; \
>>           echo "}UD=" $UD ; \
>>         done ;
>> {UD= 0
>> var_init.cpp:46:11: error: expected expression
>>         ( { ptrs...}
>>           ^
>> 1 error generated.
>> }UD= 0
>> {UD= 1
>> var_init.cpp:44:9: error: array initializer must be an initializer list
>>       : my_ptrs
>>         ^
>> var_init.cpp:60:3: note: in instantiation of member function 'var_init<int, int>::var_init' requested here
>>   vi
>>   ^
>> 1 error generated.
>> }UD= 1
>>
>> Compilation finished at Mon Jan 31 09:41:20

Page:

  http://clang.llvm.org/cxx_status.html#cxx0x

shows work on "Uniform initializers" have not been
started.  I guess that accounts for clang++
not compiling the var_init.cpp code :(

-regards,
 Larry




More information about the cfe-dev mailing list