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

Larry Evans cppljevans at suddenlink.net
Mon Jan 31 07:44:01 PST 2011


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



-------------- next part --------------
A non-text attachment was scrubbed...
Name: var_init.cpp
Type: text/x-c++src
Size: 799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110131/0c72ab7c/attachment.cpp>


More information about the cfe-dev mailing list