summaryrefslogtreecommitdiff
path: root/include/memory
diff options
context:
space:
mode:
authorDimitry Andric <dimitry@andric.com>2017-01-09 20:29:35 +0000
committerDimitry Andric <dimitry@andric.com>2017-01-09 20:29:35 +0000
commit8fe92cc0c9d18f61723ac89b5ccfd307ed7ecbca (patch)
tree16fd13805a9b713238f696f0dd4cb77030cde753 /include/memory
parent6b78198fc5a45c49ce5b2defc59c579a0884ca58 (diff)
Move _PairT declaration out of __hash_combine to avoid warning under C++98
Summary: Some parts of the FreeBSD tree are still compiled with C++98, and until rL288554 this has always worked fine. After that, a complaint about the newly introduced local _PairT is produced: /usr/include/c++/v1/memory:3354:27: error: template argument uses local type '_PairT' [-Werror,-Wlocal-type-template-args] typedef __scalar_hash<_PairT> _HashT; ^~~~~~ /usr/include/c++/v1/memory:3284:29: error: template argument uses local type '_PairT' [-Werror,-Wlocal-type-template-args] : public unary_function<_Tp, size_t> ^~~ /usr/include/c++/v1/memory:3356:12: note: in instantiation of template class 'std::__1::__scalar_hash<_PairT, 2>' requested here return _HashT()(__p); ^ As far as I can see, there should be no problem moving the _PairT struct to just before the __hash_combine() function, which fixes this particular warning. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits, emaste Differential Revision: https://reviews.llvm.org/D28472 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291476 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/memory')
-rw-r--r--include/memory9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/memory b/include/memory
index 3055a3ad5..54fd7bf49 100644
--- a/include/memory
+++ b/include/memory
@@ -3344,12 +3344,13 @@ struct __scalar_hash<_Tp, 4>
}
};
+struct _PairT {
+ size_t first;
+ size_t second;
+};
+
_LIBCPP_INLINE_VISIBILITY
inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
- struct _PairT {
- size_t first;
- size_t second;
- };
typedef __scalar_hash<_PairT> _HashT;
const _PairT __p = {__lhs, __rhs};
return _HashT()(__p);