File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -304,6 +304,7 @@ class TestOther : public TestFixture {
304304 TEST_CASE(moveForRange);
305305 TEST_CASE(moveTernary);
306306 TEST_CASE(movePointerAlias);
307+ TEST_CASE(moveTryEmplace);
307308
308309 TEST_CASE(funcArgNamesDifferent);
309310 TEST_CASE(funcArgOrderDifferent);
@@ -12730,6 +12731,17 @@ class TestOther : public TestFixture {
1273012731 ASSERT_EQUALS("[test.cpp:5:8]: (warning) Access of moved variable '.'. [accessMoved]\n", errout_str());
1273112732 }
1273212733
12734+ void moveTryEmplace()
12735+ {
12736+ check("void f(std::map<std::string, std::string>& m, std::string& s) {\n" // #12773
12737+ " bool b = m.try_emplace(\"a\", std::move(s)).second;\n"
12738+ " if (!b) {\n"
12739+ " std::cout << s;\n"
12740+ " }\n"
12741+ "}\n");
12742+ ASSERT_EQUALS("", errout_str());
12743+ }
12744+
1273312745 void funcArgNamesDifferent() {
1273412746 check("void func1(int a, int b, int c);\n"
1273512747 "void func1(int a, int b, int c) { }\n"
You can’t perform that action at this time.
0 commit comments