File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -711,8 +711,7 @@ class TestAutoVariables : public TestFixture {
711711 " g(&s);\n "
712712 " }" );
713713 ASSERT_EQUALS (
714- " [test.cpp:4:5]: (error) Address of local auto-variable assigned to a function parameter. [autoVariables]\n "
715- " [test.cpp:4:5]: (error) Address of local auto-variable assigned to a function parameter. [autoVariables]\n " , // duplicate
714+ " [test.cpp:4:5]: (error) Address of local auto-variable assigned to a function parameter. [autoVariables]\n " ,
716715 errout_str ());
717716 }
718717
@@ -4693,6 +4692,21 @@ class TestAutoVariables : public TestFixture {
46934692 " }\n " );
46944693 ASSERT_EQUALS (" " , errout_str ());
46954694
4695+ check (" struct S {\n "
4696+ " int* a[1];\n "
4697+ " int* b[1][1];\n "
4698+ " };\n "
4699+ " void f(S* s) {\n "
4700+ " int i = 0;\n "
4701+ " s->a[0] = &i;\n "
4702+ " }\n "
4703+ " void g(S* s) {\n "
4704+ " int i = 0;\n "
4705+ " s->b[0][0] = &i;\n "
4706+ " }\n " );
4707+ ASSERT_EQUALS (" [test.cpp:7:5]: (error) Address of local auto-variable assigned to a function parameter. [autoVariables]\n "
4708+ " [test.cpp:11:5]: (error) Address of local auto-variable assigned to a function parameter. [autoVariables]\n " ,
4709+ errout_str ());
46964710 }
46974711
46984712 void deadPointer () {
You can’t perform that action at this time.
0 commit comments