Does clang work correctly with gcc 4.4? <br>I was unable to compile even a hello world program using gcc 4.4 headers with clang<br><br><div class="gmail_quote">On Thu, Apr 28, 2011 at 5:22 PM, Fletcher, John P <span dir="ltr"><<a href="mailto:j.p.fletcher@aston.ac.uk">j.p.fletcher@aston.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Christopher<br>
<br>
Both -std=gnu++0x and -std=c++0x give errors in the GNU headers for gcc 4.4 (the default version of gcc on my ubuntu system)<br>
<br>
fletcher@fletcher-desktop:~/test$ gcc --version<br>
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3<br>
Copyright (C) 2009 Free Software Foundation, Inc.<br>
This is free software; see the source for copying conditions.  There is NO<br>
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br>
<br>
These errors may relate to c++0x things not yet implemented in Clang, or it could be that I need a different set of g++ headers.  I cannot tell.  Some problems are in <iostream> and some caused by clang/Basic/Version (clang 2.9)<br>

<br>
John<br>
<br>
<br>
fletcher@fletcher-desktop:~/test$ make testcpp_cpp0x<br>
/home/fletcher/LLVM/llvm/bin/clang++ -I/home/fletcher/LLVM/llvm/include -std=gnu++0x -DCLANG testcpp.cpp -otestcpp_cpp0x -L/home/fletcher/LLVM/llvm/lib -lclangBasic -lLLVMSupport -lpthread -ldl<br>
In file included from testcpp.cpp:47:<br>
In file included from /usr/include/c++/4.4/iostream:39:<br>
In file included from /usr/include/c++/4.4/ostream:39:<br>
In file included from /usr/include/c++/4.4/ios:39:<br>
In file included from /usr/include/c++/4.4/exception:148:<br>
/usr/include/c++/4.4/exception_ptr.h:143:13: error: unknown type name<br>
      'type_info'<br>
      const type_info*<br>
            ^<br>
In file included from testcpp.cpp:47:<br>
In file included from /usr/include/c++/4.4/iostream:39:<br>
In file included from /usr/include/c++/4.4/ostream:39:<br>
In file included from /usr/include/c++/4.4/ios:40:<br>
In file included from /usr/include/c++/4.4/bits/char_traits.h:40:<br>
In file included from /usr/include/c++/4.4/bits/stl_algobase.h:66:<br>
/usr/include/c++/4.4/bits/stl_pair.h:255:27: error: no matching function for<br>
      call to 'forward'<br>
        (std::forward<_T1>(__x), std::forward<_T2>(__y));<br>
                                 ^~~~~~~~~~~~~~~~~<br>
In file included from testcpp.cpp:49:<br>
In file included from /home/fletcher/LLVM/llvm/include/clang/Basic/Version.h:18:<br>
/home/fletcher/LLVM/llvm/include/llvm/ADT/StringRef.h:363:16: note: in<br>
      instantiation of function template specialization 'std::make_pair<const<br>
      llvm::StringRef &, llvm::StringRef>' requested here<br>
        return std::make_pair(*this, StringRef());<br>
               ^<br>
In file included from testcpp.cpp:47:<br>
In file included from /usr/include/c++/4.4/iostream:39:<br>
In file included from /usr/include/c++/4.4/ostream:39:<br>
In file included from /usr/include/c++/4.4/ios:40:<br>
In file included from /usr/include/c++/4.4/bits/char_traits.h:40:<br>
In file included from /usr/include/c++/4.4/bits/stl_algobase.h:66:<br>
In file included from /usr/include/c++/4.4/bits/stl_pair.h:60:<br>
/usr/include/c++/4.4/bits/move.h:51:5: note: candidate function [with _Tp =<br>
      llvm::StringRef] not viable: no known conversion from 'llvm::StringRef' to<br>
      'typename std::identity<StringRef>::type &&' (aka 'llvm::StringRef &&')<br>
      for 1st argument<br>
    forward(typename std::identity<_Tp>::type&& __t)<br>
    ^<br>
/usr/include/c++/4.4/bits/move.h:57:14: error: binding of reference to type<br>
      'typename std::remove_reference<StringRef &>::type'<br>
      (aka 'llvm::StringRef') to a value of type 'llvm::StringRef' drops<br>
      qualifiers<br>
    { return __t; }<br>
             ^~~<br>
In file included from testcpp.cpp:47:<br>
In file included from /usr/include/c++/4.4/iostream:39:<br>
In file included from /usr/include/c++/4.4/ostream:39:<br>
In file included from /usr/include/c++/4.4/ios:40:<br>
In file included from /usr/include/c++/4.4/bits/char_traits.h:40:<br>
In file included from /usr/include/c++/4.4/bits/stl_algobase.h:66:<br>
/usr/include/c++/4.4/bits/stl_pair.h:93:15: note: in instantiation of function<br>
      template specialization 'std::move<llvm::StringRef &>' requested here<br>
      : first(std::move(__p.first)),<br>
              ^<br>
In file included from testcpp.cpp:49:<br>
In file included from /home/fletcher/LLVM/llvm/include/clang/Basic/Version.h:18:<br>
/home/fletcher/LLVM/llvm/include/llvm/ADT/StringRef.h:363:16: note: in<br>
      instantiation of member function 'std::pair<llvm::StringRef,<br>
      llvm::StringRef>::pair' requested here<br>
        return std::make_pair(*this, StringRef());<br>
               ^<br>
In file included from testcpp.cpp:47:<br>
In file included from /usr/include/c++/4.4/iostream:39:<br>
In file included from /usr/include/c++/4.4/ostream:39:<br>
In file included from /usr/include/c++/4.4/ios:40:<br>
In file included from /usr/include/c++/4.4/bits/char_traits.h:40:<br>
In file included from /usr/include/c++/4.4/bits/stl_algobase.h:66:<br>
/usr/include/c++/4.4/bits/stl_pair.h:255:3: error: no matching function for call<br>
      to 'forward'<br>
        (std::forward<_T1>(__x), std::forward<_T2>(__y));<br>
         ^~~~~~~~~~~~~~~~~<br>
In file included from testcpp.cpp:49:<br>
In file included from /home/fletcher/LLVM/llvm/include/clang/Basic/Version.h:18:<br>
/home/fletcher/LLVM/llvm/include/llvm/ADT/StringRef.h:364:14: note: in<br>
      instantiation of function template specialization<br>
      'std::make_pair<llvm::StringRef, llvm::StringRef>' requested here<br>
      return std::make_pair(slice(0, Idx), slice(Idx+1, npos));<br>
             ^<br>
In file included from testcpp.cpp:47:<br>
In file included from /usr/include/c++/4.4/iostream:39:<br>
In file included from /usr/include/c++/4.4/ostream:39:<br>
In file included from /usr/include/c++/4.4/ios:40:<br>
In file included from /usr/include/c++/4.4/bits/char_traits.h:40:<br>
In file included from /usr/include/c++/4.4/bits/stl_algobase.h:66:<br>
In file included from /usr/include/c++/4.4/bits/stl_pair.h:60:<br>
/usr/include/c++/4.4/bits/move.h:51:5: note: candidate function [with _Tp =<br>
      llvm::StringRef] not viable: no known conversion from 'llvm::StringRef' to<br>
      'typename std::identity<StringRef>::type &&' (aka 'llvm::StringRef &&')<br>
      for 1st argument<br>
    forward(typename std::identity<_Tp>::type&& __t)<br>
    ^<br>
4 errors generated.<br>
make: *** [testcpp_cpp0x] Error 1<br>
<br>
________________________________________<br>
From: <a href="mailto:cfe-dev-bounces@cs.uiuc.edu">cfe-dev-bounces@cs.uiuc.edu</a> [<a href="mailto:cfe-dev-bounces@cs.uiuc.edu">cfe-dev-bounces@cs.uiuc.edu</a>] on behalf of Christopher Jefferson [<a href="mailto:chris@bubblescope.net">chris@bubblescope.net</a>]<br>

Sent: 27 April 2011 08:49<br>
To: Fletcher, John P<br>
Cc: cfe-dev Developers<br>
Subject: Re: [cfe-dev] Clang C++0x extensions<br>
<br>
On 26 Apr 2011, at 17:59, Fletcher, John P wrote:<br>
<br>
> Is there a specific command option to enable Clang C++0x extensions?  I have been looking through the manual and cannot find this.<br>
<br>
You probably want -std=gnu++0x.<br>
<br>
You can use -std=c++0x, but that disables gnu extensions. The default flag is  -std=gnu++03, and quite a bit of code (including last time I checked the standard header <cmath> on mac os x) won't compile in c++03 or c++0x mode.<br>

<br>
Chris<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br>