@@ -164,7 +164,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
164164 ((Token::Match (tok, " class|struct|union|namespace ::| %name% final| {|:|::|<" ) &&
165165 !Token::Match (tok->previous (), " new|friend|const|enum|typedef|mutable|volatile|using|)|(|<" )) ||
166166 (Token::Match (tok, " enum class| %name% {" ) ||
167- Token::Match (tok, " enum class| %name% : %name% {" ))))
167+ Token::Match (tok, " enum class| %name% : %name% ::| {" ))))
168168 || (tok->isC () && tok->isKeyword () && Token::Match (tok, " struct|union|enum %name% {" ))) {
169169 const Token *tok2 = tok->tokAt (2 );
170170
@@ -301,8 +301,11 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
301301 mTokenizer .syntaxError (tok);
302302 }
303303 } else if (new_scope->type == Scope::eEnum) {
304- if (tok2->str () == " :" )
304+ if (tok2->str () == " :" ) {
305305 tok2 = tok2->tokAt (2 );
306+ while (Token::Match (tok2, " %name%|::" ))
307+ tok2 = tok2->next ();
308+ }
306309 }
307310
308311 new_scope->setBodyStartEnd (tok2);
@@ -5152,7 +5155,8 @@ const Token * Scope::addEnum(const Token * tok)
51525155 tok2 = tok2->next ();
51535156
51545157 enumType = tok2;
5155- tok2 = tok2->next ();
5158+ while (Token::Match (tok2, " %name%|::" ))
5159+ tok2 = tok2->next ();
51565160 }
51575161
51585162 // add enumerators
@@ -6377,7 +6381,7 @@ const Type* SymbolDatabase::findTypeInNested(const Token *startTok, const Scope
63776381 startTok = startTok->next ();
63786382
63796383 // type same as scope
6380- if (startTok->str () == startScope->className && startScope-> isClassOrStruct ( ))
6384+ if (startScope-> isClassOrStruct () && startTok->str () == startScope->className && ! Token::simpleMatch (startTok-> next (), " :: " ))
63816385 return startScope->definedType ;
63826386
63836387 bool hasPath = false ;
0 commit comments