summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--unittests/ADT/StringMapTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/unittests/ADT/StringMapTest.cpp b/unittests/ADT/StringMapTest.cpp
index 2ab09b5606..130a799848 100644
--- a/unittests/ADT/StringMapTest.cpp
+++ b/unittests/ADT/StringMapTest.cpp
@@ -203,4 +203,19 @@ TEST_F(StringMapTest, InsertTest) {
assertSingleItemMap();
}
+// Create a non-default constructable value
+TEST_F(StringMapTest, NonDefaultConstructable) {
+ struct StringMapTestStruct {
+ StringMapTestStruct(int i) : i(i) {}
+ StringMapTestStruct() LLVM_DELETED_FUNCTION;
+ int i;
+ };
+
+ StringMap<StringMapTestStruct> t;
+ t.GetOrCreateValue("Test", StringMapTestStruct(123));
+ StringMap<StringMapTestStruct>::iterator iter = t.find("Test");
+ ASSERT_NE(iter, t.end());
+ ASSERT_EQ(iter->second.i, 123);
+}
+
} // end anonymous namespace