Test for signed char index in positive values range
This commit is contained in:
parent
8ef17e70ca
commit
c74282c258
|
@ -77,6 +77,14 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (warning) Signed 'char' type used as array index.\n", errout.str());
|
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"
|
check("int buf[256];\n"
|
||||||
"void foo(signed char ch)\n"
|
"void foo(signed char ch)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue