[clang] Improve the -Wundefined-func-template diagnostic note for invisible template functions (PR #129031)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 17 05:58:46 PDT 2025
================
@@ -5082,11 +5085,18 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() &&
!getSourceManager().isInSystemHeader(PatternDecl->getBeginLoc())) {
Diag(PointOfInstantiation, diag::warn_func_template_missing)
- << Function;
- Diag(PatternDecl->getLocation(), diag::note_forward_template_decl);
- if (getLangOpts().CPlusPlus11)
- Diag(PointOfInstantiation, diag::note_inst_declaration_hint)
- << Function;
+ << Function;
+ if (Unreachable) {
+ // FIXME: would be nice to mention which module the function template
+ // comes from.
+ Diag(PatternDecl->getLocation(),
----------------
hokein wrote:
The `note_inst_declaration_hint` is about a fix hint which suggests to add an explicit instantiation declaration to suppress this warning, it is not feasible to the unreachable-template-decl case.
https://github.com/llvm/llvm-project/pull/129031
More information about the cfe-commits
mailing list