Fix PR32642 - string::insert and string::append don't work with move_iterator.

llvm-svn: 300397
This commit is contained in:
Eric Fiselier
2017-04-15 06:49:02 +00:00
parent 4d53a1cb31
commit e84fcb5f3d
3 changed files with 51 additions and 6 deletions

View File

@@ -204,4 +204,20 @@ int main()
assert(s == "ABCD");
}
{ // test with a move iterator that returns char&&
typedef forward_iterator<const char*> It;
typedef std::move_iterator<It> MoveIt;
const char p[] = "ABCD";
std::string s;
s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1)));
assert(s == "ABCD");
}
{ // test with a move iterator that returns char&&
typedef const char* It;
typedef std::move_iterator<It> MoveIt;
const char p[] = "ABCD";
std::string s;
s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1)));
assert(s == "ABCD");
}
}