[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 06:18:18 PDT 2025
================
@@ -5654,6 +5654,8 @@ def warn_func_template_missing : Warning<"instantiation of function %q0 "
InGroup<UndefinedFuncTemplate>, DefaultIgnore;
def note_forward_template_decl : Note<
"forward declaration of template entity is here">;
+def note_unreachable_template_decl
+ : Note<"unreachable declaration of template entity is here">;
----------------
hokein wrote:
> should we expect Clang to sometimes complain about reachability in C++17 and below with -fmodules enabled?
I think yes. Clang already does this — in` Sema::DiagnoseUninstantiableTemplate`, when a reachable function definition is missing, Clang may emit a "missing-import" diagnostic.
However, for this particular testcase, the issue is only triggered with the C++20 standard module feature
> But it looks like the method to judge unreachable decl in this patch is the same for C++20 modules.
Yes, this aligns with my reading of the code. The same code is shared between header modules and C++20 modules.
https://github.com/llvm/llvm-project/pull/129031
More information about the cfe-commits
mailing list