Add regression test for #10473 (#3457)

This commit is contained in:
chrchr-github 2021-09-13 20:46:39 +02:00 committed by GitHub
parent 29bbb4ce14
commit 2d3b8d7003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -149,6 +149,7 @@ private:
TEST_CASE(danglingTemporaryLifetime);
TEST_CASE(invalidLifetime);
TEST_CASE(deadPointer);
TEST_CASE(splitNamespaceAuto); // crash #10473
}
@ -3194,6 +3195,18 @@ private:
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());
}
void splitNamespaceAuto() { // #10473
check("namespace ns\n"
"{\n"
" auto var{ 0 };\n"
"}\n"
"namespace ns\n"
"{\n"
" int i;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
};
REGISTER_TEST(TestAutoVariables)