dim created this revision.
dim added reviewers: EricWF, mclow.lists.
dim added subscribers: emaste, cfe-commits.

Some parts of the FreeBSD tree are still compiled with C++98, and until
https://reviews.llvm.org/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.


https://reviews.llvm.org/D28472

Files:
  include/memory


Index: include/memory
===================================================================
--- include/memory
+++ include/memory
@@ -3344,12 +3344,13 @@
     }
 };
 
+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);


Index: include/memory
===================================================================
--- include/memory
+++ include/memory
@@ -3344,12 +3344,13 @@
     }
 };
 
+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);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D28472: Move _PairT... Dimitry Andric via Phabricator via cfe-commits

Reply via email to