Fixing issues with icc. refs #120

In sandbox_vs.cpp, there is a very strange issue with calling
traits::is_input_serializable that causes icc 15.0.0 to crash.
Everything else works great though.
This commit is contained in:
Randolph Voorhies 2014-09-02 11:49:47 -07:00
parent e6cb01e89a
commit 28f9841fdb
5 changed files with 20 additions and 15 deletions

View File

@ -3,6 +3,7 @@ project (cereal)
option(SKIP_PORTABILITY_TEST "Skip portability tests" OFF)
set(CMAKE_CXX_COMPILER "icc")
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Werror -g -Wextra -Wshadow -pedantic ${CMAKE_CXX_FLAGS}")
include_directories(./include)

View File

@ -65,8 +65,8 @@ namespace cereal
CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::vector<T, A> const & vector )
{
ar( make_size_tag( static_cast<size_type>(vector.size()) ) ); // number of elements
for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
ar( *it );
for(auto && v : vector)
ar( v );
}
//! Serialization for non-arithmetic vector types
@ -79,8 +79,8 @@ namespace cereal
ar( make_size_tag( size ) );
vector.resize( static_cast<std::size_t>( size ) );
for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
ar( *it );
for(auto && v : vector)
ar( v );
}
//! Serialization for bool vector types
@ -88,8 +88,8 @@ namespace cereal
void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::vector<bool, A> const & vector )
{
ar( make_size_tag( static_cast<size_type>(vector.size()) ) ); // number of elements
for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
ar( static_cast<bool>( *it ) );
for(auto && v : vector)
ar( static_cast<bool>(v) );
}
//! Serialization for bool vector types
@ -100,11 +100,11 @@ namespace cereal
ar( make_size_tag( size ) );
vector.resize( static_cast<std::size_t>( size ) );
for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
for(auto && v : vector)
{
bool b;
ar( b );
*it = b;
v = b;
}
}
} // namespace cereal

View File

@ -266,9 +266,9 @@ public:
template <class Archive>
static void load_and_construct( Archive & ar, cereal::construct<NoDefaultCtor> & construct )
{
int y;
ar( y );
construct( y, true );
int yy;
ar( yy );
construct( yy, true );
construct->z = 33;
construct.ptr()->z = 33;
}

View File

@ -208,7 +208,11 @@ int main()
// serialiable
std::cout << "\toutput serializable" << std::endl;
std::cout << cereal::traits::is_output_serializable<T, Archive>::value << std::endl;
#if !defined(__INTEL_COMPILER)
//! TODO: This causes icc to crash
std::cout << cereal::traits::is_input_serializable<T, Archive>::value << std::endl;
#endif
// specialized
std::cout << "\tspecialized" << std::endl;

View File

@ -83,11 +83,11 @@ class MemoryCycleLoadAndConstruct
template <class Archive>
static void load_and_construct( Archive & ar, cereal::construct<MemoryCycleLoadAndConstruct> & construct )
{
int value;
std::weak_ptr<MemoryCycleLoadAndConstruct> ptr;
int val;
std::weak_ptr<MemoryCycleLoadAndConstruct> p;
ar( value, ptr );
construct( value, ptr );
ar( val, p );
construct( val, p );
}
int value;