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

Douglas Gregor dgregor at apple.com
Mon Jan 31 08:15:07 PST 2011


On Jan 31, 2011, at 7:21 AM, Douglas Gregor wrote:

> 
> On Jan 29, 2011, at 3:16 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!
>> [snip]
>> /home/evansl/prog_dev/boost-svn/ro/trunk/boost/config/no_tr1/utility.hpp:21:
>> In file included from /usr/include/c++/4.4/utility:62:
>> 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>
>>                            ^
>> /usr/include/c++/4.4/tr1_impl/type_traits:233:12: error: redefinition of
>> 'is_function<type-parameter-0-0
>>      (type-parameter-0-1...)>'
>>    struct is_function<_Res(_ArgTypes...) const>
>>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /usr/include/c++/4.4/tr1_impl/type_traits:227:12: note: previous
>> definition is here
>>    struct is_function<_Res(_ArgTypes...)>
>>           ^
>> /usr/include/c++/4.4/tr1_impl/type_traits:236:29: error: type qualifier
>> is not allowed on this function
>>    struct is_function<_Res(_ArgTypes......) const>
>>                            ^
>> /usr/include/c++/4.4/tr1_impl/type_traits:236:12: error: redefinition of
>> 'is_function<type-parameter-0-0
>>      (type-parameter-0-1..., ...)>'
>>    struct is_function<_Res(_ArgTypes......) const>
>>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /usr/include/c++/4.4/tr1_impl/type_traits:230:12: note: previous
>> definition is here
>>    struct is_function<_Res(_ArgTypes......)>
>>           ^
>> /usr/include/c++/4.4/tr1_impl/type_traits:239:29: error: type qualifier
>> is not allowed on this function
>>    struct is_function<_Res(_ArgTypes...) volatile>
> 
> libstdc++ is using a non-standard g++ extension here that Clang doesn't (yet) support. That g++ extension is the subject of core issue 547:
> 
> 	http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#547

This extension is now (narrowly) implemented in Clang:

	http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110131/038360.html

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.

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110131/70f1e4ea/attachment.html>


More information about the cfe-dev mailing list