Skip to content

Commit fe48157

Browse files
Update teststl.cpp
1 parent b3d08f1 commit fe48157

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/teststl.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,6 +2345,15 @@ class TestStl : public TestFixture {
23452345
" } \n"
23462346
"}\n");
23472347
ASSERT_EQUALS("", errout_str());
2348+
2349+
check("std::string g1();\n" // #12520
2350+
"const std::string& g2();\n"
2351+
"void f() {\n"
2352+
" g1().erase(g1().begin());\n"
2353+
" g2().erase(g2().begin());\n"
2354+
"}\n");
2355+
ASSERT_EQUALS("[test.cpp:4:7]: (error) Iterator 'g1().begin()' referring to temporary container 'g1()' is used with temporary container 'g1()'. [mismatchingContainerIterator]\n",
2356+
errout_str());
23482357
}
23492358

23502359
void eraseIteratorOutOfBounds() {

0 commit comments

Comments
 (0)