File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -4053,7 +4053,8 @@ void CheckOther::checkShadowVariables()
40534053 continue ;
40544054 if (scope.type == ScopeType::eFunction && scope.className == var.name ())
40554055 continue ;
4056- if (functionScope->functionOf && functionScope->functionOf ->isClassOrStructOrUnion () && functionScope->function && functionScope->function ->isStatic () &&
4056+ if (functionScope->functionOf && functionScope->functionOf ->isClassOrStructOrUnion () && functionScope->function &&
4057+ (functionScope->function ->isStatic () || functionScope->function ->isFriend ()) &&
40574058 shadowed->variable () && !shadowed->variable ()->isLocal ())
40584059 continue ;
40594060 shadowError (var.nameToken (), shadowed, (shadowed->varId () != 0 ) ? " variable" : " function" );
Original file line number Diff line number Diff line change @@ -12390,6 +12390,12 @@ class TestOther : public TestFixture {
1239012390 "}\n"
1239112391 "int g() { return 1; }\n");
1239212392 ASSERT_EQUALS("", errout_str());
12393+
12394+ check("struct S {\n" // #13888
12395+ " int i;\n"
12396+ " friend int f() { int i = 5; return i; }\n"
12397+ "};\n");
12398+ ASSERT_EQUALS("", errout_str());
1239312399 }
1239412400
1239512401 void knownArgument() {
You can’t perform that action at this time.
0 commit comments