From ed74a3dcc688d370d5c14baabfb95dd2002ef59a Mon Sep 17 00:00:00 2001 From: Alexander Mai Date: Fri, 24 Jul 2015 06:06:31 +0200 Subject: [PATCH] Testcase for #4683 added (which got fixed already) --- test/testuninitvar.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 612697562..b89b91d97 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -67,6 +67,7 @@ private: TEST_CASE(uninitvar_unconditionalTry); TEST_CASE(uninitvar_funcptr); // #6404 TEST_CASE(uninitvar_operator); // #6680 + TEST_CASE(uninitvar_ternaryexpression); // #4683 TEST_CASE(syntax_error); // Ticket #5073 @@ -3767,6 +3768,20 @@ private: ASSERT_EQUALS("", errout.str()); } + void uninitvar_ternaryexpression() { // #4683 + checkUninitVar("struct B { int asd; };\n" + "int f() {\n" + " int a=0;\n" + " struct B *b;\n" + " if (x) {\n" + " a = 1;\n" + " b = p;\n" + " }\n" + " return a ? b->asd : 0;\n" + "}"); + ASSERT_EQUALS("", errout.str()); + } + void syntax_error() { // Ticket #5073 // Nominal mode => No output checkUninitVar("struct flex_array {};\n"