We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12726ff commit 2129a66Copy full SHA for 2129a66
test/testnullpointer.cpp
@@ -3020,6 +3020,21 @@ class TestNullPointer : public TestFixture {
3020
" f(nullptr, nullptr);\n"
3021
"}\n", dinit(CheckOptions, $.inconclusive = true));
3022
ASSERT_EQUALS("", errout_str());
3023
+
3024
+ check("struct T {\n" // #14308
3025
+ " bool b{};\n"
3026
+ " T* next{};\n"
3027
+ "};\n"
3028
+ "bool g(const T*& r) {\n"
3029
+ " const T* t = r;\n"
3030
+ " r = t->next;\n"
3031
+ " return t->b;\n"
3032
+ "}\n"
3033
+ "void f(const T* tok) {\n"
3034
+ " if (g(tok)) {}\n"
3035
+ " if (tok) {}\n"
3036
+ "}\n", dinit(CheckOptions, $.inconclusive = true));
3037
+ ASSERT_EQUALS("", errout_str());
3038
}
3039
3040
// Check if pointer is null and the dereference it
0 commit comments