[PATCH] D30170: Function definition may have uninstantiated body

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 23:11:20 PST 2018


sepavloff marked 3 inline comments as done.
sepavloff added a comment.

Thank you!



================
Comment at: lib/Sema/SemaDecl.cpp:11995-12006
+    for (auto I : FD->redecls()) {
+      if (I != FD && !I->isInvalidDecl() &&
+          I->getFriendObjectKind() != Decl::FOK_None) {
+        if (FunctionDecl *Original = I->getInstantiatedFromMemberFunction()) {
+          if (Original->isThisDeclarationADefinition()) {
+            Definition = I;
+            break;
----------------
rsmith wrote:
> We should include a comment here explaining why we need to do this (that is, why this doesn't just fall out from the normal `isDefined` check). You can just quote C++ [temp.inst]p2:
> 
> > For the purpose of determining whether an instantiated redeclaration is valid according to [basic.def.odr] and [class.mem], a declaration that corresponds to a definition in the template is considered to be a definition.
Thank you for the reference.


Repository:
  rL LLVM

https://reviews.llvm.org/D30170





More information about the cfe-commits mailing list