From 4f146b93f1df53eaaf05a188463ed425437aed79 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Fri, 26 Oct 2012 01:11:35 -0400 Subject: [PATCH] fix bugs caught by clang++ --- include/fc/future.hpp | 2 +- include/fc/value_cast.hpp | 2 +- include/fc/value_io.hpp | 6 ++++-- include/fc/vector.hpp | 2 +- include/fc/vector_fwd.hpp | 4 ++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/fc/future.hpp b/include/fc/future.hpp index abc0119..3b6b8e1 100644 --- a/include/fc/future.hpp +++ b/include/fc/future.hpp @@ -9,7 +9,7 @@ namespace fc { class abstract_thread; - class void_t; + struct void_t; class priority; class exception_ptr; class thread; diff --git a/include/fc/value_cast.hpp b/include/fc/value_cast.hpp index 9c3ec0f..7998c23 100644 --- a/include/fc/value_cast.hpp +++ b/include/fc/value_cast.hpp @@ -191,7 +191,7 @@ namespace fc { template value::value( T&& v ) { new (holder) detail::value_holder(); - fc::pack( *this, std::forward(v) ); + fc::pack( *this, fc::forward(v) ); } } diff --git a/include/fc/value_io.hpp b/include/fc/value_io.hpp index 58b9b84..8aef083 100644 --- a/include/fc/value_io.hpp +++ b/include/fc/value_io.hpp @@ -7,6 +7,9 @@ #include namespace fc { + template + T value_cast( const value& v ); + struct void_t{}; template @@ -160,7 +163,7 @@ namespace fc { template static inline void unpack( const fc::value& jsv, T& v ) { if( strcmp( jsv.type(), "string" ) == 0 ) { - v = fc::reflector::from_string( value_cast(jsv).c_str() ); + v = fc::reflector::from_string( fc::value_cast(jsv).c_str() ); } else { // throw if invalid int, by attempting to convert to string fc::reflector::to_string( v = value_cast(jsv) ); @@ -269,7 +272,6 @@ namespace fc { } template inline void unpack( const fc::value& val, tuple& t ) { - val = fc::value::array( tuple::size ); t.visit( tuple_from_value_visitor(val) ); } diff --git a/include/fc/vector.hpp b/include/fc/vector.hpp index cb66f05..baa700d 100644 --- a/include/fc/vector.hpp +++ b/include/fc/vector.hpp @@ -298,7 +298,7 @@ namespace fc { this->reserve( this->size()+1 ); loc = this->begin() + pos; if( this->size() != 0 ) { - new (this->end()) T( fc::move(this->back()) ); + new ((void*)this->end()) T( fc::move(this->back()) ); auto cur = this->back(); ++this->_data->size; while( cur != loc ) { diff --git a/include/fc/vector_fwd.hpp b/include/fc/vector_fwd.hpp index 92760b4..e1f3d7d 100644 --- a/include/fc/vector_fwd.hpp +++ b/include/fc/vector_fwd.hpp @@ -5,8 +5,8 @@ #else namespace fc { template class vector; - template class reflector; - template class reflector< fc::vector >; + template struct reflector; + template struct reflector< fc::vector >; }; #endif