Merge pull request #139 from JustRamires/master

Ticket #4694
This commit is contained in:
Daniel Marjamäki 2013-06-08 07:46:08 -07:00
commit 616a693f1f
3 changed files with 19 additions and 1 deletions

View File

@ -799,7 +799,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
if (scope->definedType->needInitialization == Type::Unknown)
unknowns++;
}
} else if (scope->type == Scope::eUnion && scope->definedType->needInitialization == Type::Unknown)
} else if (scope->type == Scope::eUnion && scope->definedType && scope->definedType->needInitialization == Type::Unknown)
scope->definedType->needInitialization = Type::True;
}

View File

@ -8690,6 +8690,14 @@ void Tokenizer::simplifyKeyword()
}
}
if (_settings->standards.c >= Standards::C11) {
for (Token *tok = list.front(); tok; tok = tok->next()) {
while (tok->str() == "_Atomic") {
tok->deleteThis();
}
}
}
if (_settings->standards.cpp >= Standards::CPP11) {
for (Token *tok = list.front(); tok; tok = tok->next()) {
while (Token::Match(tok, "constexpr|override")) {

View File

@ -191,6 +191,7 @@ private:
TEST_CASE(symboldatabase30);
TEST_CASE(symboldatabase31);
TEST_CASE(symboldatabase33); // ticket #4682 (false negatives)
TEST_CASE(symboldatabase34); // ticket #4694 (segmentation fault)
TEST_CASE(isImplicitlyVirtual);
@ -1496,6 +1497,15 @@ private:
ASSERT(db && db->functionScopes.size() == 1);
}
void symboldatabase34() { // ticket #4694
check("typedef _Atomic(int(A::*)) atomic_mem_ptr_to_int;\n"
"typedef _Atomic(int)&atomic_int_ref;\n"
"struct S {\n"
" _Atomic union { int n; };\n"
"};");
ASSERT_EQUALS("", errout.str());
}
void isImplicitlyVirtual() {
{
GET_SYMBOL_DB("class Base {\n"