@@ -7437,9 +7437,10 @@ void Tokenizer::simplifyEnum()
74377437 if (Token::simpleMatch (tok2->previous (), " ) {" ) || Token::simpleMatch (tok2->tokAt (-2 ), " ) const {" )) {
74387438 std::set<std::string> shadowArg;
74397439 for (const Token* arg = tok2; arg && arg->str () != " (" ; arg = arg->previous ()) {
7440- if (Token::Match (arg, " %type% [,)]" ) && enumValues.find (arg->str ()) != enumValues.end ()) {
7440+ if (Token::Match (arg->previous (), " %type%|*|& %type% [,)]" ) &&
7441+ enumValues.find (arg->str ()) != enumValues.end ()) {
74417442 shadowArg.insert (arg->str ());
7442- if (_settings->isEnabled (" style" )) {
7443+ if (inScope && _settings->isEnabled (" style" )) {
74437444 const EnumValue enumValue = enumValues.find (arg->str ())->second ;
74447445 duplicateEnumError (arg, enumValue.name , " Function argument" );
74457446 }
@@ -7465,7 +7466,7 @@ void Tokenizer::simplifyEnum()
74657466 Token::Match (prev, " & %type% =" )) {
74667467 // variable declaration?
74677468 shadowVars.insert (tok3->str ());
7468- if (_settings->isEnabled (" style" )) {
7469+ if (inScope && _settings->isEnabled (" style" )) {
74697470 const EnumValue enumValue = enumValues.find (tok3->str ())->second ;
74707471 duplicateEnumError (tok3, enumValue.name , " Variable" );
74717472 }
0 commit comments