#include#include using namespace llvm; int main() { SmallVector vec{1, 2, 3, 4}; for (auto i = vec.rend(); i != vec.rbegin(); ++i) std::cout << *i << " "; std::cout << std::endl; // Output: "4 3 2 " return 0; }
#includeThis example also uses the SmallVector class from the LLVM library to create a SmallVector of integers and tries to iterate over it using the rend method, but mistakenly leaves the parentheses off the method call. This causes the loop to do nothing since rend is a member pointer and not a member function. Package/Library: LLVM (https://llvm.org/)#include using namespace llvm; int main() { SmallVector vec{1, 2, 3, 4}; for (auto i = vec.rend; i != vec.rbegin(); ++i) std::cout << *i << " "; std::cout << std::endl; // Output: nothing return 0; }