forked from OSchip/llvm-project
Adding failing LoopConvert testcase
LoopConvert isn't properly handling iterators whose dereference operator returns by value. This test case demonstrates the failure. See PR15437. llvm-svn: 176437
This commit is contained in:
parent
2f43085b46
commit
529e3c7c57
|
@ -137,4 +137,17 @@ struct Nested {
|
|||
iterator end();
|
||||
};
|
||||
|
||||
// Like llvm::SmallPtrSet, the iterator has a dereference operator that returns
|
||||
// by value instead of by reference.
|
||||
template <typename T>
|
||||
struct PtrSet {
|
||||
struct iterator {
|
||||
bool operator!=(const iterator &other) const;
|
||||
const T operator*();
|
||||
iterator &operator++();
|
||||
};
|
||||
iterator begin() const;
|
||||
iterator end() const;
|
||||
};
|
||||
|
||||
#endif // STRUCTURES_H
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
|
||||
// RUN: cpp11-migrate -loop-convert %t.cpp -- -I %S/Inputs
|
||||
// RUN: FileCheck -input-file=%t.cpp %s
|
||||
// XFAIL: *
|
||||
#include "structures.h"
|
||||
|
||||
void f() {
|
||||
// See PR15437 for details.
|
||||
PtrSet<int*> int_ptrs;
|
||||
for (PtrSet<int*>::iterator I = int_ptrs.begin(),
|
||||
E = int_ptrs.end(); I != E; ++I) {
|
||||
// CHECK: for (const auto & int_ptr : int_ptrs) {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue