[llvm] r243581 - Reapply "Add reverse(ContainerTy) range adapter."

Charles Davis cdavis5x at gmail.com
Wed Jul 29 17:41:21 PDT 2015


> On Jul 29, 2015, at 4:19 PM, Pete Cooper <peter_cooper at apple.com> wrote:
> 
> Author: pete
> Date: Wed Jul 29 17:19:09 2015
> New Revision: 243581
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=243581&view=rev
> Log:
> Reapply "Add reverse(ContainerTy) range adapter."
> 
> This reverts commit r243567, which ultimately reapplies r243563.
> 
> The fix here was to use std::enable_if for overload resolution.  Thanks to David
> Blaikie for lots of help on this, and for the extra tests!
Xcode 7 doesn’t like this:

../lib/CodeGen/AsmPrinter/ARMException.cpp:118:32: error: no matching function for call to 'reverse'
  for (const GlobalValue *GV : reverse(TypeInfos)) {
                               ^~~~~~~
../include/llvm/ADT/STLExtras.h:210:38: note: candidate template ignored: disabled by 'enable_if' [with ContainerTy = const std::__1::vector<const llvm::GlobalValue *, std::__1::allocator<const llvm::GlobalValue *> > &]
             typename std::enable_if<has_rbegin<ContainerTy>::value>::type * =
                                     ^
../include/llvm/ADT/STLExtras.h:225:6: note: candidate template ignored: substitution failure [with ContainerTy = const std::__1::vector<const llvm::GlobalValue *, std::__1::allocator<const llvm::GlobalValue *> > &]: call to 'make_reverse_iterator' is ambiguous
auto reverse(
     ^
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:2343:1: note: candidate function template not viable: requires 2 arguments, but 1 was provided
reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
^
1 error generated.

I’m pretty sure `std::vector` has an `rbegin()` method, so there must be something about your `has_rbegin` metafunction predicate that XC7 Clang doesn’t like. My own investigations seem to suggest that it has something to do with the fact that `std::vector::rbegin()` is overloaded with respect to `const`.

Chip





More information about the llvm-commits mailing list