This is an archive of the discontinued LLVM Phabricator instance.

Stop evaluating trailing requires clause after overload resolution
ClosedPublic

Authored by erichkeane on Oct 12 2022, 6:05 AM.

Details

Summary

Reported as it showed up as a constriants failure after the deferred
instantiation patch, we were checking constraints TWICE after overload
resolution. The first is during overload resolution, the second is when
diagnosing a use.

This patch modifies DiagnoseUseOfDecl to skip the trailing requires
clause check in some cases. First, of course, after choosing a candidate
after overload resolution.

The second is when evaluating a shadow using constructor, which had its
constraints checked when picking a constructor (as this is ALWAYS an
overload situation!).

Diff Detail

Event Timeline

erichkeane created this revision.Oct 12 2022, 6:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2022, 6:05 AM
shafik added a subscriber: shafik.Oct 13 2022, 1:20 PM
shafik added inline comments.
clang/lib/Sema/SemaExpr.cpp
6780

This code is commented out, did you mean to remove it? Since this is the only code using ConstraintFailLoc then that should go to if you delete this code.

clang/test/SemaTemplate/concepts.cpp
712
erichkeane marked an inline comment as done.

Thanks for the review @shafik

LGTM basically.

clang/lib/Sema/SemaExpr.cpp
6748

It looks like ConstraintFailLoc is not used?

erichkeane marked an inline comment as done.Oct 17 2022, 6:15 AM
erichkeane added inline comments.
clang/lib/Sema/SemaExpr.cpp
6748

Woops! Thanks for the catch! I'll remove it. It was a part of a previous implementation.

6780

Woops! Yes, thank you!

erichkeane marked an inline comment as done.
ChuanqiXu accepted this revision.Oct 17 2022, 7:16 PM

LGTM then.

This revision is now accepted and ready to land.Oct 17 2022, 7:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2022, 6:09 AM