Modify

Opened 5 years ago

Closed 5 years ago

#7381 closed Bugs (fixed)

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:

Description

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.

Attachments (0)

Change History (4)

comment:1 Changed 5 years ago by viboes

Status: newassigned

comment:2 Changed 5 years ago by viboes

Component: threadchrono

comment:3 Changed 5 years ago by viboes

Keywords: constexpr duration added
Milestone: To Be DeterminedBoost 1.52.0

Committed in trunk revision [80536].

comment:4 Changed 5 years ago by viboes

Resolution: fixed
Status: assignedclosed

Merged [80714]

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain viboes.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.