[PATCH] D30375: Function with unparsed body is a definition

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 12 13:27:56 PDT 2017

rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM as-is, but a couple of questions for possible further improvements.

Comment at: lib/Sema/SemaDecl.cpp:12221
+    FD->setWillHaveBody(false);
Would it make sense to leave this `true` for a defaulted function whose body has not yet been synthesized?

Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:1812-1819
       // Check for a function body.
       const FunctionDecl *Definition = nullptr;
       if (Function->isDefined(Definition) &&
           Definition->getTemplateSpecializationKind() == TSK_Undeclared) {
         SemaRef.Diag(Function->getLocation(), diag::err_redefinition)
             << Function->getDeclName();
         SemaRef.Diag(Definition->getLocation(), diag::note_previous_definition);
 Can we replace this...

Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:1841-1853
         // If some prior declaration of this function was a friend with an
         // uninstantiated definition, reject it.
         if (R->getFriendObjectKind()) {
           if (const FunctionDecl *RPattern =
                   R->getTemplateInstantiationPattern()) {
             if (RPattern->isDefined(RPattern)) {
               SemaRef.Diag(Function->getLocation(), diag::err_redefinition)
... and this with




More information about the cfe-commits mailing list