[PATCH] D126258: [Clang] Avoid misleading 'conflicting types' diagnostic with no-prototype decls.
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 24 05:00:52 PDT 2022
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM, thank you for catching this!
================
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;
----------------
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).
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