erichkeane added a comment.




================
Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:3597
+  if (FD->getFriendObjectKind() == Decl::FriendObjectKind::FOK_None &&
+      FD->isDefined(FDFriend, true) &&
+      FDFriend->getFriendObjectKind() != Decl::FriendObjectKind::FOK_None) {
----------------
I was originally REALLY suspicious about this function call here (and the setup 
with the out parameter/2nd variable here).  but it seems that the 'true' 
argument (which, needs a `/*ParamName */` comment) is specifically designed for 
this situation.


================
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
----------------
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.


================
Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:3601
+    FD = const_cast<FunctionDecl *>(FDFriend);
+    Owner = FD->getDescribedFunctionTemplate()->getLexicalDeclContext();
+  }
----------------
I THINK this should just be:
`Owner = FD->getLexicalDeclContext()` here.  


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