Skip to content

Commit 2d3b8d7

Browse files
Add regression test for #10473 (#3457)
1 parent 29bbb4c commit 2d3b8d7

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test/testautovariables.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ class TestAutoVariables : public TestFixture {
149149
TEST_CASE(danglingTemporaryLifetime);
150150
TEST_CASE(invalidLifetime);
151151
TEST_CASE(deadPointer);
152+
TEST_CASE(splitNamespaceAuto); // crash #10473
152153
}
153154

154155

@@ -3194,6 +3195,18 @@ class TestAutoVariables : public TestFixture {
31943195
ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:4] -> [test.cpp:8]: (error) Using pointer to local variable 'x' that is out of scope.\n", errout.str());
31953196
}
31963197

3198+
void splitNamespaceAuto() { // #10473
3199+
check("namespace ns\n"
3200+
"{\n"
3201+
" auto var{ 0 };\n"
3202+
"}\n"
3203+
"namespace ns\n"
3204+
"{\n"
3205+
" int i;\n"
3206+
"}\n");
3207+
ASSERT_EQUALS("", errout.str());
3208+
}
3209+
31973210
};
31983211

31993212
REGISTER_TEST(TestAutoVariables)

0 commit comments

Comments
 (0)