Issue 152395
Summary unused-template warning can be triggered even though the template is referenced by another template
Labels new issue
Assignees
Reporter ojhunt
    If you have a template in an anonymous namespace we will warn about it being unused even if it is referenced by another template, *if* the other template is not instantiated.

i.e compiling the following with -Wunused-template

```cpp
namespace {
 template <class T> void foo(T*){}
}

template <class T> void bar(T* t) {
 foo(t);
}
```

produces
`warning: unused function template 'foo' [-Wunused-template]`

The only way to silence this is by using a `[[maybe_unused]]`, which is a solution but is somewhat suboptimal.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to