mirror of
https://github.com/darlinghq/darling-libcxx.git
synced 2024-11-23 11:59:52 +00:00
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
This commit is contained in:
parent
6b78198fc5
commit
8fe92cc0c9
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user