Thank you, I've already verified that no tests are affected, so this is good to be picked up.
On Wed, Mar 20, 2013 at 1:06 AM, John McCall <[email protected]> wrote: > On Mar 18, 2013, at 10:56 AM, Stephen Lin <[email protected]> wrote: >> I found code in Sema::ActOnFriendFunctionDecl() which I am almost sure >> is dead and would like to remove it. >> >> The code in question is the following check: >> >> if (!Previous.empty() && DC->Equals(CurContext)) >> Diag(DS.getFriendSpecLoc(), >> getLangOpts().CPlusPlus11 ? >> diag::warn_cxx98_compat_friend_is_member : >> diag::err_friend_is_member); >> >> which happens immediately after this loop: >> >> DC = CurContext; >> while (true) { >> while (DC->isRecord() || DC->isTransparentContext()) >> DC = DC->getParent(); >> >> LookupQualifiedName(Previous, DC); >> >> // TODO: decide what we think about using declarations. >> if (isLocal || !Previous.empty()) >> break; >> >> if (isTemplateId) { >> if (isa<TranslationUnitDecl>(DC)) break; >> } else { >> if (DC->isFileContext()) break; >> } >> DC = DC->getParent(); >> } >> >> There doesn't seem to be any possibility that DC->Equals(CurContext) >> after this loop, since friends can only be declared in records; in any >> case the error given only makes sense in a record context anyway. (The >> same check is also present in another branch, but that one is OK since >> it involves qualified names.) >> >> Please let me know if I am correct and if this is OK to be patched. > > I agree with your analysis. Assuming that it doesn't change any test cases, > feel free to take it out. > > John. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
