This is an archive of the discontinued LLVM Phabricator instance.

Fix ADL leakage due to MSVC compatibility flag
AbandonedPublic

Authored by frederic-tingaud-sonarsource on May 13 2022, 1:41 AM.

Details

Reviewers
rnk
Summary

Patch https://reviews.llvm.org/D124613 introduced an ADL leakage of friend functions when in MSVC compatibility mode. It broke some C++ compliant code. That patch fixes the problem introduced.

The original fix flagged friend function declarations as declarations, to follow MSVC behavior. The problem it introduced is that this same flag is used to do ADL and that made friend functions visible at the namespace level instead of them being visible at the class level only.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2022, 1:41 AM
frederic-tingaud-sonarsource requested review of this revision.May 13 2022, 1:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2022, 1:41 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

After checking, I realize that the previous fix was really mimicking MSVC behavior up to its mishandling of standard compliant code.
https://godbolt.org/z/cEPGfMz3f
I'll revert it for now and try to see if there is a way to have it under another flag or something.