[cfe-dev] New C++0x feature support in Clang
Larry Evans
cppljevans at suddenlink.net
Fri Feb 4 11:54:39 PST 2011
On 02/04/11 13:38, Douglas Gregor wrote:
>
> On Feb 4, 2011, at 11:33 AM, 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
>>
>> How do I get the attached to compile without the
>> following error about no std::move?
>>
>> /home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang++ -c
>> -std=c++0x -U__GXX_EXPERIMENTAL_CXX0X__ -c -std=c++0x move.cpp
>> move.cpp:6:16: error: no member named 'move' in namespace 'std'
>> int j=std::move(i);
>> ~~~~~^
>
> I suggest following the preprocessor logic to see what std::move isn't
> getting defined. That -U__GXX_EXPERIMENTAL_CXX0X__ looks really, really
> suspicious, though.
The -U is there because, without it, the errors begin with:
/home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang++ -c
-std=c++0x -c -std=c++0x move.cpp
In file included from move.cpp:1:
In file included from /usr/include/c++/4.4/memory:48:
In file included from /usr/include/c++/4.4/bits/stl_algobase.h:66:
In file included from /usr/include/c++/4.4/bits/stl_pair.h:60:
In file included from /usr/include/c++/4.4/bits/move.h:38:
In file included from /usr/include/c++/4.4/type_traits:50:
/usr/include/c++/4.4/tr1_impl/type_traits:233:29: error: type qualifier
is not allowed on this function
struct is_function<_Res(_ArgTypes...) const>
I did read your earlier post with the remark:
We *should* have enough C++0x support to handle GCC 4.3 and 4.4's
headers. >= 4.5 headers will still cause problems due to their use of
generalized initializer lists.
My default g++ is:
/home/evansl/prog_dev $ g++ -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/
gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++
--prefix=/usr --enable-shared --enable-multiarch
--enable-linker- build-id --with-system-zlib
--libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4
--program-suffix=-4.4 --enable-nls --enable-clocale=gnu
--enable-libstdcxx-debug -
...
So, it should work, but doesn't seem to :(
Thanks for all the effort Doug.
-regards,
Larry
More information about the cfe-dev
mailing list