parent
e64ea20089
commit
2c7948102a
|
@ -78,7 +78,7 @@ static bool isEnumStart(const Token* tok)
|
|||
{
|
||||
if (!tok || tok->str() != "{")
|
||||
return false;
|
||||
return (tok->strAt(-1) == "enum") || (tok->strAt(-2) == "enum");
|
||||
return (tok->strAt(-1) == "enum") || (tok->strAt(-2) == "enum") || Token::Match(tok->tokAt(-3), "enum class %name%");
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -161,6 +161,16 @@ private:
|
|||
" int i = foo->p;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (portability) Assigning a pointer to an integer is not portable.\n", errout.str());
|
||||
|
||||
check("struct S {\n" // #10145
|
||||
" enum class E { e1, e2 };\n"
|
||||
" E e;\n"
|
||||
" char* e1;\n"
|
||||
"};\n"
|
||||
"void f(S& s) {\n"
|
||||
" s.e = S::E::e1;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void ptrcompare() {
|
||||
|
|
Loading…
Reference in New Issue