We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4754a7e commit 1a5879dCopy full SHA for 1a5879d
1 file changed
test/testautovariables.cpp
@@ -4120,6 +4120,19 @@ class TestAutoVariables : public TestFixture {
4120
" (void)m->first;\n"
4121
"}\n");
4122
ASSERT_EQUALS("[test.cpp:9:63] -> [test.cpp:9:49] -> [test.cpp:10:11]: (error) Using iterator that is a temporary. [danglingTemporaryLifetime]\n",
4123
+
4124
+ check("struct A {\n" // #14054
4125
+ " std::map<int, int> m_;\n"
4126
+ "};\n"
4127
+ "struct B {\n"
4128
+ " A a_;\n"
4129
4130
+ "B func();\n"
4131
+ "void f() {\n"
4132
+ " const std::map<int, int>::iterator m = func().a_.m_.begin();\n"
4133
+ " (void)m->first;\n"
4134
+ "}\n");
4135
+ ASSERT_EQUALS("[test.cpp:9:62] -> [test.cpp:9:48] -> [test.cpp:10:11]: (error) Using iterator that is a temporary. [danglingTemporaryLifetime]\n",
4136
errout_str());
4137
4138
check("void f(bool b) {\n"
0 commit comments