[PATCH] D119544: Deferred Concept Instantiation Implementation

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 25 07:08:02 PDT 2022


erichkeane added inline comments.


================
Comment at: clang/test/SemaTemplate/concepts.cpp:391
+
+  CausesFriendConstraint<int> CFC;
+  FriendFunc(CFC, 1);
----------------
ChuanqiXu wrote:
> erichkeane wrote:
> > erichkeane wrote:
> > > A bunch of the tests below this all fail.
> > See these two tests, which fail by saying that "::local is not a member of class 'X'".
> I've spent some time to look into this. I don't find the root cause now. But I find that it is related to the wrong lookups. The error is emitted in CheckQualifiedMemberReference. And it looks like we lookup for the original S instead of the instantiated S. And the compiler thinks the 2 structs are different. So here is the error. Do you have any other ideas?
I unfortunately had little time to work on this over the weekend, but right before I left on Friday realized that I think the idea of doing `RebuildExprInCurrentInstantiation` was the incorrect one.  It ATTEMPTS to rebuild things, but doesn't have enough information to do so (which is the case you're seeing I think?).  If I change that back to what I had before in every case, all except `CheckMemberVar::foo` fails (note `foo2` does not!).  

THAT I have tracked down to `TemplateInstantiator::TransformDecl` failing to actually transform the variable from `S<T>` to `S<int>` as you noticed.

It gets me to 3 cases where that function is called, 2 of which work.  
1- `CheckMemberVar::foo`: Fails
2- `CheckMemberVar::foo2`: Works
3- Similar example with the instantiation in the BODY of the func: Works

I am going to spend more time trying to look into that hopefully early this week.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119544/new/

https://reviews.llvm.org/D119544



More information about the cfe-commits mailing list