Skip to content

Commit 7c0d6e7

Browse files
committed
Add test
1 parent bd33cf5 commit 7c0d6e7

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

test/testautovariables.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class TestAutoVariables : public TestFixture {
6969
TEST_CASE(testautovar15); // ticket #6538
7070
TEST_CASE(testautovar16); // ticket #8114
7171
TEST_CASE(testautovar17);
72+
TEST_CASE(testautovar18);
7273
TEST_CASE(testautovar_array1);
7374
TEST_CASE(testautovar_array2);
7475
TEST_CASE(testautovar_array3);
@@ -516,6 +517,15 @@ class TestAutoVariables : public TestFixture {
516517
ASSERT_EQUALS("", errout_str());
517518
}
518519

520+
void testautovar18() {
521+
check("struct S { int* p; };\n"
522+
"void foo(struct S* s) {\n"
523+
" int x;\n"
524+
" s[2].p = &x;\n"
525+
"}\n");
526+
ASSERT_EQUALS("[test.cpp:4:5]: (error) Address of local auto-variable assigned to a function parameter. [autoVariables]\n", errout_str());
527+
}
528+
519529
void testautovar_array1() {
520530
check("void func1(int* arr[2])\n"
521531
"{\n"

0 commit comments

Comments
 (0)