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

Larry Evans cppljevans at suddenlink.net
Sat Jan 29 11:13:15 PST 2011


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;
  }


which produces errors:

make -f clang.mk
uname -a
Linux evansl-desktop 2.6.32-24-generic #41-Ubuntu SMP Thu Aug 19
01:38:40 UTC 2010 x86_64 GNU/Linux
/home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang -c
-std=c++0x -v -c test.cpp
clang version 2.9 (trunk 124525)
Target: x86_64-unknown-linux-gnu
Thread model: posix
 "/home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang" -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name test.cpp -mrelocation-model static -mdisable-fp-elim
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-target-linker-version 2.20.1 -v -resource-dir
/home/evansl/download/llvm/svn/build/Debug+Asserts/bin/../lib/clang/2.9
-std=c++0x -ferror-limit 19 -fmessage-length 116 -fexceptions
-fgnu-runtime -fdiagnostics-show-option -o test.o -x c++ test.cpp
clang -cc1 version 2.9 based upon llvm 2.9svn hosted on
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/include/c++/4.4/i486-linux-gnu/64"
ignoring nonexistent directory "/usr/include/c++/4.3"
ignoring nonexistent directory "/usr/include/c++/4.3/x86_64-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.3/backward"
ignoring nonexistent directory "/usr/include/c++/4.3"
ignoring nonexistent directory "/usr/include/c++/4.3/i486-linux-gnu/64"
ignoring nonexistent directory "/usr/include/c++/4.3/backward"
ignoring nonexistent directory "/usr/include/c++/4.3"
ignoring nonexistent directory "/usr/include/c++/4.3/arm-linux-gnueabi/"
ignoring nonexistent directory "/usr/include/c++/4.3/backward"
ignoring nonexistent directory "/usr/include/c++/4.2"
ignoring nonexistent directory "/usr/include/c++/4.2/x86_64-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.2"
ignoring nonexistent directory "/usr/include/c++/4.2/i486-linux-gnu/64"
ignoring nonexistent directory "/usr/include/c++/4.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.1"
ignoring nonexistent directory "/usr/include/c++/4.1/x86_64-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.1/backward"
ignoring nonexistent directory "/usr/include/c++/4.1"
ignoring nonexistent directory "/usr/include/c++/4.1/i486-linux-gnu/64"
ignoring nonexistent directory "/usr/include/c++/4.1/backward"
ignoring nonexistent directory "/usr/include/c++/4.5.1"
ignoring nonexistent directory "/usr/include/c++/4.5.1/x86_64-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.5.1/backward"
ignoring nonexistent directory "/usr/include/c++/4.5.1"
ignoring nonexistent directory "/usr/include/c++/4.5.1/i686-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.5.1/backward"
ignoring nonexistent directory "/usr/include/c++/4.4.4"
ignoring nonexistent directory "/usr/include/c++/4.4.4/x86_64-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4.4/backward"
ignoring nonexistent directory "/usr/include/c++/4.4.4"
ignoring nonexistent directory "/usr/include/c++/4.4.4/i686-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4.4/backward"
ignoring nonexistent directory "/usr/include/c++/4.4.3/x86_64-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4.3/i686-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4.2"
ignoring nonexistent directory "/usr/include/c++/4.4.2/x86_64-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.4.2"
ignoring nonexistent directory "/usr/include/c++/4.4.2/i686-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.4.1"
ignoring nonexistent directory "/usr/include/c++/4.4.1/x86_64-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4.1/backward"
ignoring nonexistent directory "/usr/include/c++/4.4.1"
ignoring nonexistent directory "/usr/include/c++/4.4.1/i586-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4.1/backward"
ignoring nonexistent directory "/usr/include/c++/4.3.2"
ignoring nonexistent directory "/usr/include/c++/4.3.2/x86_64-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.3.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.3.2"
ignoring nonexistent directory "/usr/include/c++/4.3.2/i386-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.3.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.3.0"
ignoring nonexistent directory "/usr/include/c++/4.3.0/x86_64-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.3.0/backward"
ignoring nonexistent directory "/usr/include/c++/4.3.0"
ignoring nonexistent directory "/usr/include/c++/4.3.0/i386-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.3.0/backward"
ignoring nonexistent directory "/usr/include/c++/4.1.2"
ignoring nonexistent directory "/usr/include/c++/4.1.2/x86_64-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.1.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.1.2"
ignoring nonexistent directory "/usr/include/c++/4.1.2/i386-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.1.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.4.3/x86_64-pc-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.4.3/i686-pc-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.3"
ignoring nonexistent directory "/usr/include/c++/4.3/i586-suse-linux/"
ignoring nonexistent directory "/usr/include/c++/4.3/backward"
ignoring nonexistent directory "/usr/include/c++/4.3"
ignoring nonexistent directory "/usr/include/c++/4.3/x86_64-suse-linux/"
ignoring nonexistent directory "/usr/include/c++/4.3/backward"
ignoring nonexistent directory "/usr/include/c++/4.4/i586-suse-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4/x86_64-suse-linux/"
ignoring nonexistent directory "/usr/include/c++/4.5"
ignoring nonexistent directory "/usr/include/c++/4.5/i586-suse-linux/"
ignoring nonexistent directory "/usr/include/c++/4.5/backward"
ignoring nonexistent directory "/usr/include/c++/4.5"
ignoring nonexistent directory "/usr/include/c++/4.5/x86_64-suse-linux/"
ignoring nonexistent directory "/usr/include/c++/4.5/backward"
ignoring nonexistent directory "/usr/include/c++/4.3.1"
ignoring nonexistent directory "/usr/include/c++/4.3.1/i686-pc-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.3.1/backward"
ignoring nonexistent directory "/usr/include/c++/4.3.1"
ignoring nonexistent directory
"/usr/include/c++/4.3.1/x86_64-unknown-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.3.1/backward"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.4.3/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.4.3/include/g++-v4/i686-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.4.3/include/g++-v4/backward"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/i686-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/backward"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4/i686-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4/backward"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4/i686-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4/backward"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4/x86_64-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4/backward"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4/x86_64-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4/backward"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4/x86_64-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4/backward"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4/x86_64-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4/backward"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4/i686-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4/backward"
ignoring nonexistent directory
"/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1"
ignoring nonexistent directory
"/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1/x86_64-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1/backward"
ignoring duplicate directory "/usr/include/c++/4.4"
ignoring duplicate directory "/usr/include/c++/4.4/backward"
ignoring duplicate directory "/usr/include/c++/4.4"
ignoring duplicate directory "/usr/include/c++/4.4/backward"
ignoring duplicate directory "/usr/include/c++/4.4"
ignoring duplicate directory "/usr/include/c++/4.4/backward"
ignoring duplicate directory "/usr/include/c++/4.4"
ignoring duplicate directory "/usr/include/c++/4.4/backward"
ignoring duplicate directory "/usr/include/c++/4.4"
ignoring duplicate directory "/usr/include/c++/4.4/backward"
ignoring duplicate directory "/usr/include/c++/4.4"
ignoring duplicate directory "/usr/include/c++/4.4/backward"
ignoring duplicate directory "/usr/include/c++/4.4"
ignoring duplicate directory "/usr/include/c++/4.4/backward"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.4
 /usr/include/c++/4.4/x86_64-linux-gnu
 /usr/include/c++/4.4/backward
 /usr/local/include
 /home/evansl/download/llvm/svn/build/Debug+Asserts/bin/../lib/clang/2.9/include
 /usr/include
End of search list.
In file included from test.cpp:1:
In file included from /usr/include/c++/4.4/iostream:39:
In file included from /usr/include/c++/4.4/ostream:39:
In file included from /usr/include/c++/4.4/ios:39:
In file included from /usr/include/c++/4.4/exception:148:
/usr/include/c++/4.4/exception_ptr.h:143:13: error: unknown type name
'type_info'
      const type_info*
            ^
In file included from test.cpp:1:
In file included from /usr/include/c++/4.4/iostream:39:
In file included from /usr/include/c++/4.4/ostream:39:
In file included from /usr/include/c++/4.4/ios:40:
In file included from /usr/include/c++/4.4/bits/char_traits.h:40:
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>





More information about the cfe-dev mailing list