Commit 715cb38e authored by Jose Dapena Paz's avatar Jose Dapena Paz Committed by Commit Bot

Make base::WeakPtr move constructor/operator noexcept to fix GCC build regression

A GCC build regression has happened on DisjointRangeLockManager, as its move
operator and constructor were declared noexcept. This was failing because the
default implementation depended on base::WeakPtr, that did not provide
noexcept declaration for them.

So make base::WeakPtr noexcept.

Bug: 819294
Change-Id: I936784b881c7c1afea136ceedbe9341e76464f95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1708141Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: José Dapena Paz <jose.dapena@lge.com>
Cr-Commit-Position: refs/heads/master@{#680341}
parent 451e3e6c
......@@ -46,7 +46,7 @@ WeakReference::WeakReference(const scoped_refptr<Flag>& flag) : flag_(flag) {}
WeakReference::~WeakReference() = default;
WeakReference::WeakReference(WeakReference&& other) = default;
WeakReference::WeakReference(WeakReference&& other) noexcept = default;
WeakReference::WeakReference(const WeakReference& other) = default;
......
......@@ -116,9 +116,9 @@ class BASE_EXPORT WeakReference {
explicit WeakReference(const scoped_refptr<Flag>& flag);
~WeakReference();
WeakReference(WeakReference&& other);
WeakReference(WeakReference&& other) noexcept;
WeakReference(const WeakReference& other);
WeakReference& operator=(WeakReference&& other) = default;
WeakReference& operator=(WeakReference&& other) noexcept = default;
WeakReference& operator=(const WeakReference& other) = default;
bool IsValid() const;
......@@ -153,9 +153,9 @@ class BASE_EXPORT WeakPtrBase {
~WeakPtrBase();
WeakPtrBase(const WeakPtrBase& other) = default;
WeakPtrBase(WeakPtrBase&& other) = default;
WeakPtrBase(WeakPtrBase&& other) noexcept = default;
WeakPtrBase& operator=(const WeakPtrBase& other) = default;
WeakPtrBase& operator=(WeakPtrBase&& other) = default;
WeakPtrBase& operator=(WeakPtrBase&& other) noexcept = default;
void reset() {
ref_ = internal::WeakReference();
......@@ -236,7 +236,7 @@ class WeakPtr : public internal::WeakPtrBase {
ptr_ = reinterpret_cast<uintptr_t>(t);
}
template <typename U>
WeakPtr(WeakPtr<U>&& other) : WeakPtrBase(std::move(other)) {
WeakPtr(WeakPtr<U>&& other) noexcept : WeakPtrBase(std::move(other)) {
// Need to cast from U* to T* to do pointer adjustment in case of multiple
// inheritance. This also enforces the "U is a T" rule.
T* t = reinterpret_cast<U*>(other.ptr_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment