Index: test/std/utilities/optional/optional.hash/hash.pass.cpp
===================================================================
--- test/std/utilities/optional/optional.hash/hash.pass.cpp
+++ test/std/utilities/optional/optional.hash/hash.pass.cpp
@@ -22,11 +22,15 @@
 struct A {};
 struct B {};
 
+namespace std {
+
 template <>
-struct std::hash<B> {
+struct hash<B> {
   size_t operator()(B const&) { return 0; }
 };
 
+}
+
 int main()
 {
     using std::optional;
Index: test/std/utilities/variant/variant.hash/hash.pass.cpp
===================================================================
--- test/std/utilities/variant/variant.hash/hash.pass.cpp
+++ test/std/utilities/variant/variant.hash/hash.pass.cpp
@@ -124,13 +124,17 @@
 struct A {};
 struct B {};
 
+namespace std {
+
 template <>
-struct std::hash<B> {
+struct hash<B> {
   size_t operator()(B const&) const {
     return 0;
   }
 };
 
+}
+
 void test_hash_variant_enabled() {
   {
     test_hash_enabled_for_type<std::variant<int> >();