[PATCH] D28472: Move _PairT declaration out of __hash_combine to avoid warning under C++98

2017-01-09 Thread Dimitry Andric via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291476: Move _PairT declaration out of __hash_combine to 
avoid warning under C++98 (authored by dim).

Changed prior to commit:
  https://reviews.llvm.org/D28472?vs=83654=83672#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28472

Files:
  libcxx/trunk/include/memory


Index: libcxx/trunk/include/memory
===
--- libcxx/trunk/include/memory
+++ libcxx/trunk/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: libcxx/trunk/include/memory
===
--- libcxx/trunk/include/memory
+++ libcxx/trunk/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 declaration out of __hash_combine to avoid warning under C++98

2017-01-09 Thread Dimitry Andric via Phabricator via cfe-commits
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