FS#26808 - [clang] clang -std=c++0x broken for included headers

Attached to Project: Arch Linux
Opened by Ruben Van Boxem (rubenvb) - Tuesday, 08 November 2011, 18:50 GMT
Last edited by Evangelos Foutras (foutrelis) - Thursday, 08 December 2011, 21:40 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Evangelos Foutras (foutrelis)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
Clang ships with its own C++ headers (Why? they're libstdc++'s headers, which version?) which fail to be useful (ie produce errors).

Additional info:
* package version: 2.9-7

Steps to reproduce:
Try to compile following simple c++ code with Arch's Clang:
#include <iostream>
int main()
{
std::cout << "Hello world!" << std::endl;
}
with: clang++ test.cpp -std=c++0x -o test
creates these errors:
In file included from test.cpp:1:
In file included from /usr/include/c++/clang-2.9/iostream:39:
In file included from /usr/include/c++/clang-2.9/ostream:39:
In file included from /usr/include/c++/clang-2.9/ios:39:
In file included from /usr/include/c++/clang-2.9/exception:150:
/usr/include/c++/clang-2.9/exception_ptr.h:132:13: error: unknown type name
'type_info'
const type_info*
^
In file included from test.cpp:1:
In file included from /usr/include/c++/clang-2.9/iostream:39:
In file included from /usr/include/c++/clang-2.9/ostream:39:
In file included from /usr/include/c++/clang-2.9/ios:39:
In file included from /usr/include/c++/clang-2.9/exception:151:
/usr/include/c++/clang-2.9/nested_exception.h:62:49: error: expected expression
nested_exception(const nested_exception&) = default;
^
/usr/include/c++/clang-2.9/nested_exception.h:64:60: error: expected expression
nested_exception& operator=(const nested_exception&) = default;
^
/usr/include/c++/clang-2.9/nested_exception.h:77:50: error: expected expression
inline nested_exception::~nested_exception() = default;
^
/usr/include/c++/clang-2.9/nested_exception.h:122:61: error: redefinition of
default argument
__throw_with_nested(_Ex&& __ex, const nested_exception* = 0)
^ ~
/usr/include/c++/clang-2.9/nested_exception.h:110:56: note: previous definition
is here
__throw_with_nested(_Ex&&, const nested_exception* = 0)
^ ~
In file included from test.cpp:1:
In file included from /usr/include/c++/clang-2.9/iostream:39:
In file included from /usr/include/c++/clang-2.9/ostream:39:
In file included from /usr/include/c++/clang-2.9/ios:40:
In file included from /usr/include/c++/clang-2.9/bits/char_traits.h:40:
In file included from /usr/include/c++/clang-2.9/bits/stl_algobase.h:66:
In file included from /usr/include/c++/clang-2.9/bits/stl_pair.h:60:
In file included from /usr/include/c++/clang-2.9/bits/move.h:38:
/usr/include/c++/clang-2.9/type_traits:178:51: error: '_Tp' does not refer to a
value
: public integral_constant<bool, __is_trivial(_Tp)>
^
/usr/include/c++/clang-2.9/type_traits:176:21: note: declared here
template<typename _Tp>
^
/usr/include/c++/clang-2.9/type_traits:179:8: error: expected class name
{ };
^
/usr/include/c++/clang-2.9/type_traits:179:8: error: expected
'{' after base class list
/usr/include/c++/clang-2.9/type_traits:184:59: error: '_Tp' does not refer to a
value
: public integral_constant<bool, __is_standard_layout(_Tp)>
^
/usr/include/c++/clang-2.9/type_traits:182:21: note: declared here
template<typename _Tp>
^
/usr/include/c++/clang-2.9/type_traits:185:8: error: expected class name
{ };
^
/usr/include/c++/clang-2.9/type_traits:185:8: error: expected
'{' after base class list
11 errors generated.
[ruben@arch-vbox Development]$ clang++ -std=c++0x test.cpp -o test > log.txt
In file included from test.cpp:1:
In file included from /usr/include/c++/clang-2.9/iostream:39:
In file included from /usr/include/c++/clang-2.9/ostream:39:
In file included from /usr/include/c++/clang-2.9/ios:39:
In file included from /usr/include/c++/clang-2.9/exception:150:
/usr/include/c++/clang-2.9/exception_ptr.h:132:13: error: unknown type name
'type_info'
const type_info*
^
In file included from test.cpp:1:
In file included from /usr/include/c++/clang-2.9/iostream:39:
In file included from /usr/include/c++/clang-2.9/ostream:39:
In file included from /usr/include/c++/clang-2.9/ios:39:
In file included from /usr/include/c++/clang-2.9/exception:151:
/usr/include/c++/clang-2.9/nested_exception.h:62:49: error: expected expression
nested_exception(const nested_exception&) = default;
^
/usr/include/c++/clang-2.9/nested_exception.h:64:60: error: expected expression
nested_exception& operator=(const nested_exception&) = default;
^
/usr/include/c++/clang-2.9/nested_exception.h:77:50: error: expected expression
inline nested_exception::~nested_exception() = default;
^
/usr/include/c++/clang-2.9/nested_exception.h:122:61: error: redefinition of
default argument
__throw_with_nested(_Ex&& __ex, const nested_exception* = 0)
^ ~
/usr/include/c++/clang-2.9/nested_exception.h:110:56: note: previous definition
is here
__throw_with_nested(_Ex&&, const nested_exception* = 0)
^ ~
In file included from test.cpp:1:
In file included from /usr/include/c++/clang-2.9/iostream:39:
In file included from /usr/include/c++/clang-2.9/ostream:39:
In file included from /usr/include/c++/clang-2.9/ios:40:
In file included from /usr/include/c++/clang-2.9/bits/char_traits.h:40:
In file included from /usr/include/c++/clang-2.9/bits/stl_algobase.h:66:
In file included from /usr/include/c++/clang-2.9/bits/stl_pair.h:60:
In file included from /usr/include/c++/clang-2.9/bits/move.h:38:
/usr/include/c++/clang-2.9/type_traits:178:51: error: '_Tp' does not refer to a
value
: public integral_constant<bool, __is_trivial(_Tp)>
^
/usr/include/c++/clang-2.9/type_traits:176:21: note: declared here
template<typename _Tp>
^
/usr/include/c++/clang-2.9/type_traits:179:8: error: expected class name
{ };
^
/usr/include/c++/clang-2.9/type_traits:179:8: error: expected
'{' after base class list
/usr/include/c++/clang-2.9/type_traits:184:59: error: '_Tp' does not refer to a
value
: public integral_constant<bool, __is_standard_layout(_Tp)>
^
/usr/include/c++/clang-2.9/type_traits:182:21: note: declared here
template<typename _Tp>
^
/usr/include/c++/clang-2.9/type_traits:185:8: error: expected class name
{ };
^
/usr/include/c++/clang-2.9/type_traits:185:8: error: expected
'{' after base class list
11 errors generated.

I believe the C++ headers in the /usr/include/clang/c++ directory are from GCC 4.4, which is just abysmal. There has been a lot of recent and less recent work into getting Clang to find all distro's headers, and clang should be able to find the headers with very minor patching for Arch as well (if it does not already).

This task depends upon

Closed by  Evangelos Foutras (foutrelis)
Thursday, 08 December 2011, 21:40 GMT
Reason for closing:  Fixed
Additional comments about closing:  clang 3.0-1 is now in [extra].
Comment by Ruben Van Boxem (rubenvb) - Tuesday, 08 November 2011, 18:51 GMT
FYI: Clang parses most (if not all) of GCC 4.6 headers without a hitch, no need to use old GCC versions (which are on top of it all incompatible).
Comment by Evangelos Foutras (foutrelis) - Sunday, 13 November 2011, 04:48 GMT
The headers in /usr/include/clang/c++ are from GCC 4.5.2. We included them because clang didn't support some C++11 features used in GCC 4.6's headers.

LLVM 3.0 should be released soon, so I will give it a try with the headers in /usr/include/c++/4.6.2.
Comment by Evangelos Foutras (foutrelis) - Monday, 05 December 2011, 05:01 GMT
This should be solved with clang 3.0-1 currently in [testing].

Loading...