[PATCH] D23418: [analyzer] Added a reusable constraint system to the CloneDetector

Raphael Isemann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 6 04:51:24 PDT 2017


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 at ftlserver ~/test> clang++ test.cpp -std=c++11 ; and ./a.out 
Different behavior


https://reviews.llvm.org/D23418





More information about the cfe-commits mailing list