Fixed #2737 ((error) Analysis failed. If the code is valid then please report this failure.)

This commit is contained in:
Daniel Marjamäki 2011-05-19 17:04:36 +02:00
parent 1ea52cfa02
commit ab1b293f23
2 changed files with 12 additions and 1 deletions

View File

@ -9472,7 +9472,8 @@ void Tokenizer::simplifyBitfields()
Token *last = 0;
if (Token::Match(tok, ";|{|}|public:|protected:|private: const| %type% %var% :") &&
!Token::Match(tok->next(), "case|public|protected|private|class|struct"))
!Token::Match(tok->next(), "case|public|protected|private|class|struct") &&
!Token::simpleMatch(tok->tokAt(2), "default :"))
{
int offset = 0;
if (tok->next()->str() == "const")

View File

@ -302,6 +302,7 @@ private:
TEST_CASE(bitfields7); // ticket #1987
TEST_CASE(bitfields8);
TEST_CASE(bitfields9); // ticket #2706
TEST_CASE(bitfields10);
TEST_CASE(microsoftMFC);
@ -5330,6 +5331,15 @@ private:
ASSERT_EQUALS("", errout.str());
}
void bitfields10() // ticket #2737
{
const char code[] = "{}"
"MACRO "
"default: { }"
";";
ASSERT_EQUALS("{ } MACRO default : { } ;", tokenizeAndStringify(code,false));
}
void microsoftMFC()
{
const char code1[] = "class MyDialog : public CDialog { DECLARE_MESSAGE_MAP() private: CString text; };";