Opened 11 years ago

Closed 11 years ago

#5635 closed Bugs (fixed)

compile error due to __is_pod conflicts with clang 3.x on osx 10.6

Reported by: Dane Springmeyer <dane@…> Owned by: John Maddock
Milestone: To Be Determined Component: type_traits
Version: Boost Development Trunk Severity: Regression
Keywords: Cc:

Description

Boost trunk no longer compiles with clang trunk on my system (mac osx 10.6) if a header like boost/iterator/iterator_facade.hpp or boost/filesystem/operations.hpp is included that leverages type_traits/is_pod.hpp.

A simple test case is:

clang++ -o test.o -c -I/opt/boost-trunk/include test.cpp

#include <boost/iterator/iterator_facade.hpp>

int main() {
  return 0;
}

This results in:

In file included from test.cpp:1:
In file included from test.cpp:1:
In file included from /opt/boost-trunk/include/boost/iterator/iterator_facade.hpp:26:
/opt/boost-trunk/include/boost/type_traits/is_pod.hpp:40:129: error: 'T' does not refer to a value
  ...= (::boost::type_traits::ice_or< ::boost::is_scalar<T>::value, ::boost::is_void<T>::value, __is_pod(T) >::value);
                                                                                                         ^
/opt/boost-trunk/include/boost/type_traits/is_pod.hpp:38:20: note: declared here
template <typename T> struct is_pod_impl
                   ^
/opt/boost-trunk/include/boost/type_traits/is_pod.hpp:40:141: error: type name requires a specifier or qualifier
  ...= (::boost::type_traits::ice_or< ::boost::is_scalar<T>::value, ::boost::is_void<T>::value, __is_pod(T) >::value);
                                                                                                                     ^
/opt/boost-trunk/include/boost/type_traits/is_pod.hpp:40:141: error: C++ requires a type specifier for all declarations
  ...= (::boost::type_traits::ice_or< ::boost::is_scalar<T>::value, ::boost::is_void<T>::value, __is_pod(T) >::value);
                                                                                                                     ^
/opt/boost-trunk/include/boost/type_traits/is_pod.hpp:40:141: error: expected ')'
/opt/boost-trunk/include/boost/type_traits/is_pod.hpp:40:31: note: to match this '('
    static const bool value = (::boost::type_traits::ice_or< ::boost::is_scalar<T>::value, ...
                              ^
4 errors generated.

See also: http://dbsgeo.com/tmp/clang-boost-error.ii

I am seeing this with boost trunk svn r72721 and clang trunk:

$ clang -v
clang version 3.0 (trunk 131789)
Target: x86_64-apple-darwin10.7.0
Thread model: posix

Developers on the #llvm irc.oftc.net channel helped advise that the reason is likely conflicting is_pod definitions. To quote the details:

there's a horrible compatibility hack in clang to cope with gcc's treatment of __is_pod
basically, __is_pod is a compiler intrinsic, unless it's defined as an identifier, at which point it loses its magic
this is because gcc <4.4 defined an __is_pod struct in libstdc++ and gcc>=4.4 define an __is_pod intrinsic (iirc)
type_traits/intrinsics.hpp is using __is_pod as the definition of BOOST_IS_POD, which would be fine, except that your translation unit also pulls in libstdc++ 4.2.1's bits/cpp_type_traits.h, which defines __is_pod

Change History (3)

comment:1 by anonymous, 11 years ago

Severity: ShowstopperRegression

Use of clang intrinsics was reverted on trunk in r72725, that should be included in the final release.

Downgrading the severity since this is a problem with an unreleased compiler.

comment:2 by Dane Springmeyer <dane@…>, 11 years ago

great. thanks, that appears to fix things.

comment:3 by John Maddock, 11 years ago

Resolution: fixed
Status: newclosed

(In [72758]) Revert Clang intrinsics support - it doesn't always work presently. Change authorized by eric niebler. Fixes #5635.

Note: See TracTickets for help on using tickets.