fix #2878 (derived global class not tokenized properly (class A : ::B { };))

This commit is contained in:
Robert Reif 2011-06-30 07:25:36 -04:00
parent 586fdd24f2
commit 77859b9a0f
2 changed files with 25 additions and 0 deletions

View File

@ -430,6 +430,21 @@ void Tokenizer::createTokens(std::istream &code)
addtoken("&&", lineno, FileIndex, true);
continue;
}
else if (ch==':' && CurrentToken.empty() && code.peek() == ' ')
{
// :
addtoken(":", lineno, FileIndex, true);
CurrentToken.clear();
continue;
}
else if (ch==':' && CurrentToken.empty() && code.peek() == ':')
{
// ::
ch = (char)code.get();
addtoken("::", lineno, FileIndex, true);
CurrentToken.clear();
continue;
}
else
{
if (CurrentToken == "#file")

View File

@ -2232,6 +2232,16 @@ private:
" } obj;\n"
"};\n");
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'LocalClass::bitsInData_' is not initialized in the constructor.\n", errout.str());
checkUninitVar("Object::MemFunc() {\n"
" class LocalClass : ::copy_protected {\n"
" public:\n"
" LocalClass() : copy_protected(1), dataLength_(0) {}\n"
" std::streamsize dataLength_;\n"
" double bitsInData_;\n"
" } obj;\n"
"};\n");
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'LocalClass::bitsInData_' is not initialized in the constructor.\n", errout.str());
}
void uninitVarArray1()