Commit 434ac46
authored
Improve the -Wundefined-func-template diagnostic note for invisible template functions (#129031)
See discussion in #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.
```1 parent 1f84495 commit 434ac46
File tree
6 files changed
+70
-17
lines changed- clang
- docs
- include/clang
- Basic
- Sema
- lib/Sema
- test/Modules
6 files changed
+70
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
| 281 | + | |
| 282 | + | |
281 | 283 | | |
282 | 284 | | |
283 | 285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5700 | 5700 | | |
5701 | 5701 | | |
5702 | 5702 | | |
| 5703 | + | |
| 5704 | + | |
5703 | 5705 | | |
5704 | 5706 | | |
5705 | 5707 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11268 | 11268 | | |
11269 | 11269 | | |
11270 | 11270 | | |
11271 | | - | |
11272 | | - | |
11273 | | - | |
11274 | | - | |
11275 | | - | |
11276 | | - | |
11277 | | - | |
| 11271 | + | |
| 11272 | + | |
| 11273 | + | |
| 11274 | + | |
| 11275 | + | |
11278 | 11276 | | |
11279 | 11277 | | |
11280 | 11278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
765 | 765 | | |
766 | 766 | | |
767 | 767 | | |
768 | | - | |
| 768 | + | |
769 | 769 | | |
770 | 770 | | |
771 | 771 | | |
| |||
778 | 778 | | |
779 | 779 | | |
780 | 780 | | |
| 781 | + | |
| 782 | + | |
781 | 783 | | |
782 | 784 | | |
783 | 785 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5386 | 5386 | | |
5387 | 5387 | | |
5388 | 5388 | | |
| 5389 | + | |
| 5390 | + | |
5389 | 5391 | | |
5390 | 5392 | | |
5391 | | - | |
5392 | | - | |
5393 | | - | |
5394 | | - | |
| 5393 | + | |
| 5394 | + | |
| 5395 | + | |
| 5396 | + | |
| 5397 | + | |
5395 | 5398 | | |
5396 | 5399 | | |
5397 | 5400 | | |
| |||
5416 | 5419 | | |
5417 | 5420 | | |
5418 | 5421 | | |
5419 | | - | |
5420 | | - | |
5421 | | - | |
5422 | | - | |
5423 | | - | |
| 5422 | + | |
| 5423 | + | |
| 5424 | + | |
| 5425 | + | |
| 5426 | + | |
| 5427 | + | |
| 5428 | + | |
| 5429 | + | |
| 5430 | + | |
| 5431 | + | |
| 5432 | + | |
| 5433 | + | |
5424 | 5434 | | |
5425 | 5435 | | |
5426 | 5436 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments