Commit cf4053d2 authored by Stephan Hartmann's avatar Stephan Hartmann Committed by Commit Bot

GCC: fix template specialization in ListHashSetNodeBasePointer

GCC complains that explicit specialization in non-namespace scope
is happening for GetSafe()/SetSafe(). However, secialization is
not really necessary here with templates and can be moved
into GetSafe()/SetSafe() methods without changing generated code.

Bug: 819294
Change-Id: Ib6d7b7760b7b1f3f88a395f5ab3fb4788defbb89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2010793Reviewed-by: default avatarYuta Kitamura <yutak@chromium.org>
Commit-Queue: Yuta Kitamura <yutak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735766}
parent 337aa0b2
......@@ -308,21 +308,16 @@ class ListHashSetNodeBasePointer {
NodeType& operator*() const { return *Get(); }
private:
template <bool = Allocator::kIsGarbageCollected>
void SetSafe(NodeType* node) {
AsAtomicPtr(&node_)->store(node, std::memory_order_relaxed);
}
template <>
void SetSafe<false>(NodeType* node) {
node_ = node;
if (Allocator::kIsGarbageCollected)
AsAtomicPtr(&node_)->store(node, std::memory_order_relaxed);
else
node_ = node;
}
template <bool = Allocator::kIsGarbageCollected>
NodeType* GetSafe() const {
return AsAtomicPtr(&node_)->load(std::memory_order_relaxed);
}
template <>
NodeType* GetSafe<false>() const {
if (Allocator::kIsGarbageCollected)
return AsAtomicPtr(&node_)->load(std::memory_order_relaxed);
return node_;
}
......
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