Merge pull request #769 from Dmitry-Me/testNoWarningWhenCharIndexInRange

Test for signed char index in positive values range
This commit is contained in:
Dmitry-Me 2016-01-31 13:43:18 +03:00
commit cdf68353ae
1 changed files with 8 additions and 0 deletions

View File

@ -77,6 +77,14 @@ private:
"}");
ASSERT_EQUALS("[test.cpp:5]: (warning) Signed 'char' type used as array index.\n", errout.str());
check("int buf[256];\n"
"void foo()\n"
"{\n"
" signed char ch = 0;\n"
" buf[ch] = 0;\n"
"}");
ASSERT_EQUALS("", errout.str());
check("int buf[256];\n"
"void foo(signed char ch)\n"
"{\n"