summaryrefslogtreecommitdiff
path: root/unittests/ADT/StringMapTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/ADT/StringMapTest.cpp')
-rw-r--r--unittests/ADT/StringMapTest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/unittests/ADT/StringMapTest.cpp b/unittests/ADT/StringMapTest.cpp
index b6d41bcc8e..42a0388618 100644
--- a/unittests/ADT/StringMapTest.cpp
+++ b/unittests/ADT/StringMapTest.cpp
@@ -218,4 +218,20 @@ TEST_F(StringMapTest, NonDefaultConstructable) {
ASSERT_EQ(iter->second.i, 123);
}
+struct MoveOnly {
+ int i;
+ MoveOnly(int i) : i(i) {}
+ MoveOnly(MoveOnly&&) = default;
+ MoveOnly(const MoveOnly&) = delete;
+ MoveOnly &operator=(MoveOnly&&) = default;
+ MoveOnly &operator=(const MoveOnly&) = delete;
+};
+
+TEST_F(StringMapTest, MoveOnlyKey) {
+ StringMap<MoveOnly> t;
+ t.GetOrCreateValue("Test", MoveOnly(42));
+ StringRef Key = "Test";
+ StringMapEntry<MoveOnly>::Create(Key.begin(), Key.end(), MoveOnly(42))->Destroy();
+}
+
} // end anonymous namespace