Symbol database: Fixed bug when end of namespace wasn't found. Ticket: #1895
This commit is contained in:
parent
6efad92647
commit
7c18ece65d
|
@ -85,15 +85,17 @@ void CheckClass::createSymbolDatabase()
|
|||
tok = tok2;
|
||||
}
|
||||
|
||||
// check if in class
|
||||
else if (info && !info->isNamespace)
|
||||
// check if in space
|
||||
else if (info)
|
||||
{
|
||||
// check for end of class
|
||||
// check for end of space
|
||||
if (tok == info->classEnd)
|
||||
{
|
||||
info = info->nest;
|
||||
}
|
||||
else
|
||||
|
||||
// check if in class or structure
|
||||
else if (!info->isNamespace)
|
||||
{
|
||||
// What section are we in..
|
||||
if (tok->str() == "private:")
|
||||
|
|
|
@ -135,6 +135,7 @@ private:
|
|||
TEST_CASE(const28); // ticket #1883
|
||||
TEST_CASE(const29); // ticket #1922
|
||||
TEST_CASE(const30);
|
||||
TEST_CASE(const31);
|
||||
TEST_CASE(constoperator1); // operator< can often be const
|
||||
TEST_CASE(constoperator2); // operator<<
|
||||
TEST_CASE(constincdec); // increment/decrement => non-const
|
||||
|
@ -3852,6 +3853,17 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void const31()
|
||||
{
|
||||
checkConst("namespace std { }\n"
|
||||
"class Fred {\n"
|
||||
"public:\n"
|
||||
" int a;\n"
|
||||
" int get() { return a; }\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("[test.cpp:5]: (style) The function 'Fred::get' can be const\n", errout.str());
|
||||
}
|
||||
|
||||
// increment/decrement => not const
|
||||
void constincdec()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue