Reapply "ADT: Remove references in has_rbegin for reverse()"
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 18 Aug 2016 17:15:25 +0000 (17:15 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 18 Aug 2016 17:15:25 +0000 (17:15 +0000)
commit9d748f949977dc972694fb5a9f3a11575521f182
treea14fb0cb48a3ef038f2bbc34c1636938e77c7811
parenta8105c607b434a1ae2af35fd4ef0fe46f43c33cf
Reapply "ADT: Remove references in has_rbegin for reverse()"

This reverts commit r279086, reapplying r279084.  I'm not sure what I
ran before, because the compile failure for ADTTests reproduced locally.

The problem is that TestRev is calling BidirectionalVector::rbegin()
when the BidirectionalVector is const, but rbegin() is always non-const.
I've updated BidirectionalVector::rbegin() to be callable from const.

Original commit message follows.

--

As a follow-up to r278991, add some tests that check that
decltype(reverse(R).begin()) == decltype(R.rbegin()), and get them
passing by adding std::remove_reference to has_rbegin.

I'm using static_assert instead of EXPECT_TRUE (and updated the other
has_rbegin check from r278991 in the same way) since I figure that's
more helpful.

llvm-svn: 279091
llvm/include/llvm/ADT/STLExtras.h
llvm/unittests/ADT/RangeAdapterTest.cpp