Worked around GCC bug 56480. Explicit specialization in a different namespace.

Summary: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

Reviewers: EricWF

Reviewed By: EricWF

Differential Revision: https://reviews.llvm.org/D31273

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298581 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael Park
2017-03-23 06:21:24 +00:00
parent 570f32c8dd
commit ad3680b23e
2 changed files with 10 additions and 2 deletions

View File

@@ -22,11 +22,15 @@
struct A {}; struct A {};
struct B {}; struct B {};
namespace std {
template <> template <>
struct std::hash<B> { struct hash<B> {
size_t operator()(B const&) { return 0; } size_t operator()(B const&) { return 0; }
}; };
}
int main() int main()
{ {
using std::optional; using std::optional;

View File

@@ -125,13 +125,17 @@ void test_hash_variant_duplicate_elements() {
struct A {}; struct A {};
struct B {}; struct B {};
namespace std {
template <> template <>
struct std::hash<B> { struct hash<B> {
size_t operator()(B const&) const { size_t operator()(B const&) const {
return 0; return 0;
} }
}; };
}
void test_hash_variant_enabled() { void test_hash_variant_enabled() {
{ {
test_hash_enabled_for_type<std::variant<int> >(); test_hash_enabled_for_type<std::variant<int> >();