This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Suppress lookup diagnostics when checking reversed operators
AbandonedPublic

Authored by ilya-biryukov on Aug 11 2023, 5:41 AM.

Details

Reviewers
shafik
rsmith
Group Reviewers
Restricted Project
Summary

The standard specified that Clang should 'search' for members in this
case, which does not involve full lookup and the corresponding checks.

See [over.match.oper]p4 and [basic.lookup.general]p3.

The added test has an example code that breaks.
The change that exposed this behavior is cc1b6668c57170cd440d321037ced89d6a61a9cb.

Diff Detail

Event Timeline

ilya-biryukov created this revision.Aug 11 2023, 5:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2023, 5:41 AM
ilya-biryukov requested review of this revision.Aug 11 2023, 5:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2023, 5:41 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
ilya-biryukov added inline comments.Aug 11 2023, 5:45 AM
clang/lib/Sema/SemaOverload.cpp
967

I believe we should be able to expose the same errorenous behavior here, but I did not come up with a test yet, so did not change it yet.
We should update it and come up with a test before the change lands.

But I still wanted to get early feedback on the direction of this patch, so sending for review right away.

ilya-biryukov added a reviewer: Restricted Project.Aug 21 2023, 8:11 AM

@shafik, @rsmith friendly ping for a review.

Also adding clang-language-wg for a wider set of potential reviewers.

The prior behavior of Clang is correct. A search of a class scope is ill-formed if it finds an ambiguous result, see http://eel.is/c++draft/basic.lookup#class.member.lookup-6.sentence-2

ilya-biryukov abandoned this revision.Aug 22 2023, 6:03 AM

Thanks for clarifying! I misread the standard.