fix #2878 (derived global class not tokenized properly (class A : ::B { };))
This commit is contained in:
parent
586fdd24f2
commit
77859b9a0f
|
@ -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")
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue