[PATCH] D126258: [Clang] Avoid misleading 'conflicting types' diagnostic with no-prototype decls.

Cyndy Ishida via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 24 06:08:18 PDT 2022


cishida added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:3914-3918
+      if (Old->hasInheritedPrototype())
+        Old = Old->getCanonicalDecl();
       Diag(New->getLocation(), diag::err_conflicting_types) << New;
       Diag(Old->getLocation(), PrevDiag) << Old << Old->getType();
       return true;
----------------
aaron.ballman wrote:
> I don't think it's safe to assign this new value to `Old` as that object is what we eventually merge the declaration with (so we'll get the decl chain order wrong, I believe).
Ah, I hadn't realized we still can merge decls together in a fatal error case. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126258



More information about the cfe-commits mailing list