You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testautovariables.cpp
+34Lines changed: 34 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1420,6 +1420,19 @@ class TestAutoVariables : public TestFixture {
1420
1420
"[test.cpp:5] -> [test.cpp:6] -> [test.cpp:4] -> [test.cpp:6]: (error) Non-local variable 'v' will use object that points to local variable 'i'.\n",
1421
1421
errout.str());
1422
1422
1423
+
check("struct A {\n"
1424
+
" std::vector<int*> m;\n"
1425
+
" void f() {\n"
1426
+
" int x;\n"
1427
+
" std::vector<int*> v;\n"
1428
+
" v.push_back(&x);\n"
1429
+
" m.insert(m.end(), v.begin(), v.end());\n"
1430
+
" }\n"
1431
+
"};\n");
1432
+
ASSERT_EQUALS(
1433
+
"[test.cpp:6] -> [test.cpp:6] -> [test.cpp:6] -> [test.cpp:4] -> [test.cpp:7]: (error) Non-local variable 'm' will use object that points to local variable 'x'.\n",
1434
+
errout.str());
1435
+
1423
1436
check("struct A {\n"
1424
1437
" std::vector<std::string> v;\n"
1425
1438
" void f() {\n"
@@ -1483,6 +1496,27 @@ class TestAutoVariables : public TestFixture {
0 commit comments