erichkeane added inline comments.

================
Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:3598
+      FD->isDefined(FDFriend, true) &&
+      FDFriend->getFriendObjectKind() != Decl::FriendObjectKind::FOK_None) {
+    // if Function defined by inline friend, use inline fried as DeclContext
----------------
HerrCai0907 wrote:
> erichkeane wrote:
> > So in what case would the currently-instantiated definition NOT also be a 
> > friend?  I would think this last condition should be able to be an assert 
> > instead.
> Last condition cannot be an assert, define and declare in difference place is 
> common case, what we need to identifier in here is inlined friend define.
Can you be more clear here?  WHEN can a definition and declaration NOT have the 
same friend object kind?  THAT is probably incorrect a bug.


================
Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:3601
+    FD = const_cast<FunctionDecl *>(FDFriend);
+    Owner = FD->getDescribedFunctionTemplate()->getLexicalDeclContext();
+  }
----------------
HerrCai0907 wrote:
> erichkeane wrote:
> > I THINK this should just be:
> > `Owner = FD->getLexicalDeclContext()` here.  
> The old `Owner` is `FunctionTemplate->getLexicalDeclContext()`. So I think we 
> should use same level owner.
Its not a question of "SameLevel", its that it was the accessible one based on 
what was around.  IN this case, we have a 'better' alternative, which is the 
FunctionDecl.  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149009

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to