diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-04-29 10:53:29 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-04-29 10:53:29 +0000 |
commit | 3703baacf5c17425a07d57583148086a746c5f98 (patch) | |
tree | a4ec787be70b12edb920ed7758a2698b8d609977 /unittests/ADT | |
parent | bbd8e5d79ac4cdc5d205230eac88f69fd309df53 (diff) |
SmallVector: Don't rely on having an assignment operator around in push_back for POD-like types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155791 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ADT')
-rw-r--r-- | unittests/ADT/SmallVectorTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/unittests/ADT/SmallVectorTest.cpp b/unittests/ADT/SmallVectorTest.cpp index d5bfe76800..c2542d614e 100644 --- a/unittests/ADT/SmallVectorTest.cpp +++ b/unittests/ADT/SmallVectorTest.cpp @@ -413,4 +413,17 @@ TEST_F(SmallVectorTest, IteratorTest) { theVector.insert(theVector.end(), L.begin(), L.end()); } +struct notassignable { + int &x; + notassignable(int &x) : x(x) {} +}; + +TEST_F(SmallVectorTest, NoAssignTest) { + int x = 0; + SmallVector<notassignable, 2> vec; + vec.push_back(notassignable(x)); + x = 42; + EXPECT_EQ(42, vec.pop_back_val().x); +} + } |