parent
97ce569859
commit
297b0b5c60
|
@ -2967,7 +2967,7 @@ void CheckOther::checkUnusedLabel()
|
|||
if (!tok->scope()->isExecutable())
|
||||
tok = tok->scope()->bodyEnd;
|
||||
|
||||
if (Token::Match(tok, "{|}|; %name% :") && tok->strAt(1) != "default") {
|
||||
if (Token::Match(tok, "{|}|; %name% :") && !tok->tokAt(1)->isKeyword()) {
|
||||
const std::string tmp("goto " + tok->strAt(1));
|
||||
if (!Token::findsimplematch(scope->bodyStart->next(), tmp.c_str(), tmp.size(), scope->bodyEnd->previous()))
|
||||
unusedLabelError(tok->next(), tok->next()->scope()->type == Scope::eSwitch, hasIfdef);
|
||||
|
|
|
@ -4071,6 +4071,11 @@ private:
|
|||
" return 1;\n" // <- clarify for tools that function does not continue..
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f() {\n"
|
||||
" enum : uint8_t { A, B } var = A;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue