[PATCH] D53046: [Sema] Fix an error-on-valid with friends and templates

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 9 15:10:26 PDT 2018


erik.pilkington added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:10015
     // merged.
     if (MergeFunctionDecl(NewFD, OldDecl, S, MergeTypeWithPrevious)) {
       NewFD->setInvalidDecl();
----------------
The problem is here, MergeFunctionDecl() needs the injected template args, but...


================
Comment at: clang/lib/Sema/SemaDecl.cpp:10026
       auto *OldFD = OldTemplateDecl->getTemplatedDecl();
       NewFD->setPreviousDeclaration(OldFD);
       adjustDeclContextForDeclaratorDecl(NewFD, OldFD);
----------------
... we don't link the two declarations until here!


Repository:
  rC Clang

https://reviews.llvm.org/D53046





More information about the cfe-commits mailing list