[Boost-bugs] [Boost C++ Libraries] #7381: C++11 compliance: unresolved symbol when assigning a constexpr duration to a non-const local variable

Subject: [Boost-bugs] [Boost C++ Libraries] #7381: C++11 compliance: unresolved symbol when assigning a constexpr duration to a non-const local variable
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-16 07:56:24


#7381: C++11 compliance: unresolved symbol when assigning a constexpr duration to
a non-const local variable
------------------------------+---------------------------------------------
 Reporter: viboes | Owner: viboes
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.51.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 When assigning a template static value member of type constexpr
 boost::chrono::duration to a non-const local variable

 {{{

 template <int Val, typename Type>
 struct dummy
 {
   typedef Type type;
   static constexpr type value{static_cast<type>(Val)};
 };

 void aTest(){
    auto z3 = dummy2<7,boost::chrono::hours>::value;
 }

 }}}

 There is an unresolved symbol link error.

 The reason is that the boost::chrono::duration copy constructor must be
 =default on c++11 so that the type can be used as a constexpr.

 Removing the following declaration in boost/chrono/duration

 {{{
   BOOST_CONSTEXPR duration(const duration& rhs) : rep_(rhs.rep_) {} // =
 default;
 }}}

 solves the issue.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7381>
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-02-16 18:50:10 UTC