Diagnose when reverse_iterator is used on path::iterator.

path::iterator isn't a strictly conforming iterator. Specifically
it stashes the current element inside the iterator. This leads to
UB when used with reverse_iterator since it requires the element
to outlive the lifetime of the iterator.

This patch adds a static_assert inside reverse_iterator to disallow
"stashing iterator types", and it tags path::iterator as such a type.

Additionally this patch removes all uses of reverse_iterator<path::iterator>
within the tests.

llvm-svn: 300164
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: e02ed1c255d717827268fd0789148a06df5d0970
diff --git a/include/experimental/filesystem b/include/experimental/filesystem
index 04180d1..42157ba 100644
--- a/include/experimental/filesystem
+++ b/include/experimental/filesystem
@@ -1092,20 +1092,12 @@
 public:
     typedef bidirectional_iterator_tag iterator_category;
 
-    // FIXME: As of 3/April/2017 Clang warns on `value_type` shadowing the
-    // definition in path. Clang should be fixed and this should be removed.
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wshadow"
-#endif
     typedef path                       value_type;
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
     typedef std::ptrdiff_t             difference_type;
     typedef const path*                pointer;
     typedef const path&                reference;
+
+    typedef void __stashing_iterator_tag; // See reverse_iterator and __is_stashing_iterator
 public:
     _LIBCPP_INLINE_VISIBILITY
     iterator() : __stashed_elem_(), __path_ptr_(nullptr),