Ticket #7381 (closed Bugs: fixed)

Opened 5 years ago

Last modified 5 years ago

C++11 compliance: unresolved symbol when assigning a constexpr duration to a non-const local variable

Reported by: viboes Owned by: viboes
Milestone: Boost 1.52.0 Component: chrono
Version: Boost 1.51.0 Severity: Problem
Keywords: constexpr duration Cc:


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.


Change History

comment:1 Changed 5 years ago by viboes

  • Status changed from new to assigned

comment:2 Changed 5 years ago by viboes

  • Component changed from thread to chrono

comment:3 Changed 5 years ago by viboes

  • Keywords constexpr duration added
  • Milestone changed from To Be Determined to Boost 1.52.0

Committed in trunk revision [80536].

comment:4 Changed 5 years ago by viboes

  • Status changed from assigned to closed
  • Resolution set to fixed

Merged [80714]


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.