[all-commits] [llvm/llvm-project] 434ac4: Improve the -Wundefined-func-template diagnostic n...
Haojian Wu via All-commits
all-commits at lists.llvm.org
Wed Mar 19 02:52:07 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 434ac4612f2b43a5b7f1a8e3b5310e8d129360e6
https://github.com/llvm/llvm-project/commit/434ac4612f2b43a5b7f1a8e3b5310e8d129360e6
Author: Haojian Wu <hokein.wu at gmail.com>
Date: 2025-03-19 (Wed, 19 Mar 2025)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/include/clang/Sema/Sema.h
M clang/lib/Sema/SemaTemplate.cpp
M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
A clang/test/Modules/diag-undefined-template.cpp
Log Message:
-----------
Improve the -Wundefined-func-template diagnostic note for invisible template functions (#129031)
See discussion in https://github.com/llvm/llvm-project/issues/125071.
Makes the note clearer for the unreachable case:
Before:
```
./hoge.h:5:12: warning: instantiation of function 'x<int>' required here, but no definition is available [-Wundefined-func-template]
5 | void f() { x<int>(); }
| ^
./shared_ptr2.h:4:6: note: forward declaration of template entity is here
4 | void x() { T t; (void)t; }
| ^
./hoge.h:5:12: note: add an explicit instantiation declaration to suppress this warning if 'x<int>' is explicitly instantiated in another translation unit
5 | void f() { x<int>(); }
|
```
After:
```
./hoge.h:5:12: warning: instantiation of function 'x<int>' required here, but no definition is available [-Wundefined-func-template]
5 | void f() { x<int>(); }
| ^
./shared_ptr2.h:4:6: note: declaration of template entity is unreachable here
4 | void x() { T t; (void)t; }
| ^
1 warning generated.
```
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list