one definition rule: Fixed false positive for 'class A::B ..'
This commit is contained in:
parent
084bc74080
commit
a21c81365d
|
@ -2859,6 +2859,11 @@ Check::FileInfo *CheckClass::getFileInfo(const Tokenizer *tokenizer, const Setti
|
|||
std::string name;
|
||||
const Scope *scope = classScope;
|
||||
while (scope->isClassOrStruct() && !classScope->className.empty()) {
|
||||
if (Token::Match(scope->classDef, "struct|class %name% :: %name%")) {
|
||||
// TODO handle such classnames
|
||||
name.clear();
|
||||
break;
|
||||
}
|
||||
name = scope->className + "::" + name;
|
||||
scope = scope->nestedIn;
|
||||
}
|
||||
|
|
|
@ -7428,6 +7428,9 @@ private:
|
|||
|
||||
ctu({"class C { C(); }; C::C(){}", "class C { C(); }; C::C(){}"});
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
ctu({"class A::C { C() { std::cout << 0; } };", "class B::C { C() { std::cout << 1; } };"});
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void getFileInfo(const char code[]) {
|
||||
|
|
Loading…
Reference in New Issue