Re: [Boost-bugs] [Boost C++ Libraries] #13108: BOOST_STATIC_ASSERT occurs when serializing a class with default constructor explicitly defined

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #13108: BOOST_STATIC_ASSERT occurs when serializing a class with default constructor explicitly defined
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-07-12 19:17:16


#13108: BOOST_STATIC_ASSERT occurs when serializing a class with default
constructor explicitly defined
-------------------------------+---------------------------
  Reporter: nest_kds@… | Owner: Robert Ramey
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: serialization
   Version: Boost 1.64.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+---------------------------

Comment (by Richard Hazlewood <boost@…>):

 Same issue occurs for g++ 4.6.4 (with -std=c++0x).
 It looks like {{{boost::serialization::detail::is_default_constructible}}}
 falls into using {{{boost::has_trivial_constructor}}}; however, it may be
 that this just does not fully work for these compilers (see docs:
 http://www.boost.org/doc/libs/1_64_0/libs/type_traits/doc/html/boost_typetraits/reference/has_trivial_constructor.html)

 Oddly enough the constructor declared with {{{= default}}} passes on g++
 4.6.4; e.g.\\
 ( g++-4.6 -W -Wall -std=c++0x ... )

 {{{

 #include "boost/serialization/detail/is_default_constructible.hpp"

 #ifndef BOOST_HAS_TRIVIAL_CONSTRUCTOR
 #error
 #endif

 struct T
 {
   T() = default;
 };

 struct X
 {
   X() {}
 };

 int main(int argc, char *argv[])
 {
   (void)argc; (void)argv;

   static_assert(BOOST_HAS_TRIVIAL_CONSTRUCTOR(T), "t fail");
   static_assert(BOOST_HAS_TRIVIAL_CONSTRUCTOR(X), "x fail");
 }
 }}}

 boost_htd.cpp:22:3: error: static assertion failed: "x fail"

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13108#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-07-12 19:20:42 UTC