astIsFloat: expression 'floatvar ? 0x40 : 0' is not float
This commit is contained in:
parent
55a8009e97
commit
76020d2ad0
|
@ -34,7 +34,7 @@ namespace {
|
||||||
|
|
||||||
static bool astIsFloat(const Token *tok, bool unknown)
|
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;
|
return true;
|
||||||
if (tok->astOperand2() && astIsFloat(tok->astOperand2(), unknown))
|
if (tok->astOperand2() && astIsFloat(tok->astOperand2(), unknown))
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -4329,6 +4329,12 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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"
|
check("void f() {\n"
|
||||||
" short ss[] = {1, 2};\n"
|
" short ss[] = {1, 2};\n"
|
||||||
" memset(ss, 256, 4);\n"
|
" memset(ss, 256, 4);\n"
|
||||||
|
|
Loading…
Reference in New Issue