Skip to content

Commit e2a000c

Browse files
Add test for #12436
1 parent b8991ba commit e2a000c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎test/testother.cpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12999,6 +12999,16 @@ class TestOther : public TestFixture {
1299912999
"}\n");
1300013000
ASSERT_EQUALS("[test.cpp:4:9]: (warning) Access of moved variable 'p'. [accessMoved]\n"
1300113001
"[test.cpp:5:9]: (warning) Access of moved variable 'p'. [accessMoved]\n", errout_str());
13002+
13003+
check("void h(std::unique_ptr<int>);\n" // #12436
13004+
"void g(int);\n"
13005+
"void f() {\n"
13006+
" std::unique_ptr<int> p = std::make_unique<int>(5);\n"
13007+
" int* w = p.get();\n"
13008+
" h(std::move(p));\n"
13009+
" g(*w);\n"
13010+
"}\n");
13011+
ASSERT_EQUALS("[test.cpp:5:10]: (style) Variable 'w' can be declared as pointer to const [constVariablePointer]\n", errout_str());
1300213012
}
1300313013

1300413014
void moveAndAddressOf() {

0 commit comments

Comments
 (0)