Skip to content

Commit

Permalink
Allow std::atomic<MonoTime> usage with clang and libstdc++
Browse files Browse the repository at this point in the history
Summary:
clang couldn't compile libstdc++ atomic<T> unless T is nothrow default constructible.
More details:
- https://stackoverflow.com/a/29483269/461529
- https://bugs.llvm.org/show_bug.cgi?id=33550
- http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1778
Solution for our specific issue is to define MonoTime default ctor as noexcept.

Test Plan: Run `ybd release --sj --clang` on CentOS

Reviewers: mikhail, hector, sergei

Reviewed By: hector, sergei

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D4298
  • Loading branch information
ttyusupov committed Mar 7, 2018
1 parent 13724f5 commit e96545a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/yb/util/monotime.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class MonoTime {
// Return the earliest (minimum) of the two monotimes.
static const MonoTime& Earliest(const MonoTime& a, const MonoTime& b);

MonoTime() {}
MonoTime() noexcept {}
MonoTime(std::chrono::steady_clock::time_point value) : value_(value) {} // NOLINT

bool Initialized() const { return value_ != std::chrono::steady_clock::time_point(); }
Expand Down

0 comments on commit e96545a

Please sign in to comment.