Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
36 Views

Compilation errors on standard header files in libc++

MacOS 10.10.3, Xcode 6.3.2, Intel Composer 2015 sp 3. Compiling against 10.10 (or 10.9) SDK, including any standard header (such as <algorithm>) that eventually includes cpp_type_traits.h or allocator.h, I get the errors below if the C++ standard library is set to libc++. The errors go away if I use libstdc++:

cpp_type_traits (from OS X 10.10/usr/include/c++/4.2.1/bits/cpp_type_traits.h)

 
line 379:  // For the immediate use, the following is a good approximation.
template<typename _Tp>
struct __is_pod     <— Error: expected an identifier
{
enum
{
__value = (sizeof(__detail::__test_type<_Tp>(0))
!= sizeof(__detail::__one))
};
};
 
//
// A stripped-down version of std::tr1::is_empty
//
template<typename _Tp>
struct __is_empty   <— Error: expected an identifier
{
private:
template<typename>
struct __first { };
template<typename _Up>
struct __second
: public _Up { };
 
public:
enum
{
__value = sizeof(__first<_Tp>) == sizeof(__second<_Tp>)
};
};
 
 
allocator.h
 
  // To implement Option 3 of DR 431.
template<typename _Alloc, bool = std::__is_empty<_Alloc>::__value>  <— Error : expected an identifier; the global scope has no “__value”; expected a “,” or “>”
 
struct __alloc_swap
{ static void _S_do_it(_Alloc&, _Alloc&) { } };
 
template<typename _Alloc>
struct __alloc_swap<_Alloc, false>  <— Error: a template argument list is not allowed in a declaration of a primary template
{
static void
_S_do_it(_Alloc& __one, _Alloc& __two)
{
// Precondition: swappable allocators.
if (__one != __two)
swap(__one, __two);
}
};
 
0 Kudos
1 Reply
Highlighted
36 Views

One of our engineers tracked this down to an xcconfig file that contained:

 
ICC_OTHER_CFLAGS = $(OTHER_CFLAGS) -wd177,1478,1899 -vec_report0 -use-msasm -no-cxxlib -isystem$(SDKROOT)/usr/include/c++/4.2.1
 

The orange option is deprecated but harmless; the red item apparently caused this problem. We can now build this module against libc++.

 

0 Kudos