Test for signed char index in positive values range

This commit is contained in:
Dmitry-Me 2016-01-29 11:09:25 +03:00
parent 8ef17e70ca
commit c74282c258
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"