Stop evaluating trailing requires clause after overload resolution
authorErich Keane <erich.keane@intel.com>
Tue, 11 Oct 2022 13:16:41 +0000 (06:16 -0700)
committerErich Keane <erich.keane@intel.com>
Tue, 18 Oct 2022 13:08:10 +0000 (06:08 -0700)
commit4bcb85c638c1c1719c5c01a70ee2e376e4032d2a
tree90934139533e48ad169fd13da0dc2d45aac3486c
parent2946b252993d9b4c12479bf318b648bed2c0427a
Stop evaluating trailing requires clause after overload resolution

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!).

Differential Revision: https://reviews.llvm.org/D135772
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaOverload.cpp
clang/test/SemaTemplate/concepts.cpp