<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/152395>152395</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            unused-template warning can be triggered even though the template is referenced by another template
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ojhunt
      </td>
    </tr>
</table>

<pre>
    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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8k0GPszYQhn_NcBklAgMhHDiQ3UbqfaUeKxsG7E_GRtgO4t9XhmTztZVWskDYvM_MvJ7hzqnREDVQ3qD8THjw0i6N_SWD8Ymw_db8OeBmA0r-IOToaZo194TKII_Lmm2ywaHhE7mZd4Qr4aq0xpUvBrmwwaPyKEiZEYMJjnqkBxlUQ9xXDhcaaCHTUY9ii0gvafmOBOwDgbVqANail4T_Po4AYz0q4zw3XnFP_RnSFtJWnQk7O81Kx9BROlit7Rq_VuUlnv468jl9x9p1cEmP1c0zpO27MqhukLbv0JB_dJo7h1-Q_4EPq3ocrAV2_QLWAqvj_9VnJB7PtP1JKvjylKIHVr-iHcS4A_ntzXrleHDnxfahI3ecROeVGSFvX4YPwXReWfNb7qzayRVCefu_EeXnN_srem70hivf0Ft0SsfLQi-Vi-6LDYOLnnKMmthIt4lvgv4-oJF14NgHrlJ1Mqo4OqvDnpMIexs4O9EquUcXhJ29mrg-J32T93Ve84SarCqLMqvyokpkQ_lQXK7ptWAX6otiyK-dqAXxC9V9X1c8UQ1LWZle0wvLyrKozp2orkXWcaqLS5ZlFRQpTVzps9aP6WyXMVHOBWqykuV1mWguSLt9LhgztOJ-CozFMVmaKDqJMDooUq2cd2-MV15T8x9D8Xkn2HGDgtAvahxpec2ClzaMcu_R3xv758lIwqIb6f3sIG-B3YHdR-VlEOfOTsDuMaPn6zQv9hd1Hth9r8MBuz8LfTTsnwAAAP__LeVQpw">