Skip to content

Commit

Permalink
Update testsymboldatabase.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Jul 17, 2024
1 parent a9ad708 commit 9cf704b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ class TestSymbolDatabase : public TestFixture {
TEST_CASE(enum15);
TEST_CASE(enum16);
TEST_CASE(enum17);
TEST_CASE(enum18);

TEST_CASE(sizeOfType);

Expand Down Expand Up @@ -6452,6 +6453,25 @@ class TestSymbolDatabase : public TestFixture {
}
}

void enum18() {
{
GET_SYMBOL_DB("namespace {\n"
" enum { E0 };\n"
"}\n"
"void f() {\n"
" if (0 > E0) {}\n"
"}\n");
ASSERT(db != nullptr);
auto it = db->scopeList.begin();
std::advance(it, 2);
const Enumerator* E0 = it->findEnumerator("E0");
ASSERT(E0 && E0->value_known && E0->value == 0);
const Token* const e = Token::findsimplematch(tokenizer.tokens(), "E0 )");
ASSERT(e && e->enumerator());
ASSERT_EQUALS(E0, e->enumerator());
}
}

void sizeOfType() {
// #7615 - crash in Symboldatabase::sizeOfType()
GET_SYMBOL_DB("enum e;\n"
Expand Down

0 comments on commit 9cf704b

Please sign in to comment.