astIsFloat: expression 'floatvar ? 0x40 : 0' is not float

This commit is contained in:
Daniel Marjamäki 2014-07-26 09:09:58 +02:00
parent 55a8009e97
commit 76020d2ad0
2 changed files with 7 additions and 1 deletions

View File

@ -34,7 +34,7 @@ namespace {
static bool astIsFloat(const Token *tok, bool unknown)
{
if (tok->astOperand1() && astIsFloat(tok->astOperand1(),unknown))
if (tok->astOperand1() && tok->str() != "?" && astIsFloat(tok->astOperand1(),unknown))
return true;
if (tok->astOperand2() && astIsFloat(tok->astOperand2(), unknown))
return true;

View File

@ -4329,6 +4329,12 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
check("void f() {\n" // FP
" float x = 2.3f;\n"
" memset(a, (x?64:0), 40);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
check("void f() {\n"
" short ss[] = {1, 2};\n"
" memset(ss, 256, 4);\n"