Skip to content

Commit 20e63bc

Browse files
Update testnullpointer.cpp
1 parent a5a7dd7 commit 20e63bc

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/testnullpointer.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4830,6 +4830,15 @@ class TestNullPointer : public TestFixture {
48304830
"[test.cpp:5:20]: note: Assignment 'f=fopen(notexist,t)', assigned value is 0\n"
48314831
"[test.cpp:6:8]: note: Calling function foo, 1st argument is null\n"
48324832
"[test.cpp:2:13]: note: Dereferencing argument f that is null\n", errout_str());
4833+
4834+
ctu("void g(std::optional<int>& o) {\n" // #14728
4835+
" *o = 1;\n"
4836+
"}\n"
4837+
"void f() {\n"
4838+
" std::optional<int> x = 0;\n"
4839+
" g(x);\n"
4840+
"}\n");
4841+
ASSERT_EQUALS("", errout_str());
48334842
}
48344843
};
48354844

0 commit comments

Comments
 (0)