teemperor added a comment.

I think for range loops work differently:

#include <cassert>
#include <vector>
#include <iostream>

struct Foo {
 int* begin() const { assert(false); }
 int* end() const { assert(false); }
 void bar() const { std::cout << "Different behavior" << std::endl; }
};

int main() {

  std::vector<Foo*> F;
  F.resize(1);
  for (const Foo* F : F) {
      F->bar();
  }

}

teemperor@ftlserver ~/test> clang++ test.cpp -std=c++11 ; and ./a.out 
Different behavior


https://reviews.llvm.org/D23418



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to