<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJylVEuT2yAM_jX4oknGwXEcH3zIY7fTQ0_tTM-yITYdDB6Ds2l-fYWTbB59zGaagVhI4kOfkCit-Fl8aySwRTz5Lmw1tNJ49Moa0sAb9kaZGmq1lw4QdqidhM465UkDb400cNkU_BC8bDuNnpywx1Z62cNeYYD3o4YExjeARtAEeei0qpS_blPGeSSwMQQQstK0a5SVg8FJMWXxlsWr83-6_qKMalETFBKEZOmW8WXjfedYsmL8lUZtRWm1n9q-ptWR5jw7ojl8Oi4Yz4PbLSQFOI6q686aEQR21k6bO89RH0yvZHrQPbqwdHNKABzgq20l7FEP8rzrnT1LNsp4OLDk5WTZWyXCycRpDHX9ewDwckniX3N3PkYe6DrMNdfv4MlmFk78xxmB_DUhtxbGE2UqPQiKnvNTkji_c_kcLuZaV89RPgFla5ZtP8z94YgP8bxc-61yY9tOaSrsa408uPE5UJbJga9pwEMLwaS6z9xlkaxSmgualxYLIuPZe5mQDJVt29AooeyJIHVX0BA4-AZ9aAhjPaD3WDXk4e1t_922DrXJGOVEKKyNdV5Vk_teT7dPFSyEH0tfWHY__pSjSBSJyJMcIxx8Y_uiwl5bV6Pey2MXDb0uHtpV-WYop8SVFlrvL59J19sfsvK0VM4N0pGQ8jzLoqYQi-UinvFluYxRJIt8nvFyJ2cpyh3Pq7iMNJZSu4IyQdVZDnWoUXqH6HO6v2S1663x0ohgSbfR_0elCh5zHs_i-SzmWZJPd3GazNNdnibZQs7Eks1j2aLS04ATXqeoL0ZIis-RUSvn3dWIzqnaSDmSoAi98npcnBikW3i9f54fqzFU6PlOg_jE4xuN1IqR1y-R8uO1>52977</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] False positive -Wdocumentation + tparam + explicit template instantiation declaration
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            clang:frontend
      </td>
    </tr>

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

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

<pre>
    The `-Wdocumentation` warning gives a false positive when documenting a template parameter via `tparam`, and an explicit template instantiation declaration is used.

[Minimal example](https://godbolt.org/z/47zanxGz6):

```cpp
// foo.h

/// Foo.
///
/// \tparam x Some value.
template <int x>
void foo();

// Explicit instantiation declaration.
extern template void foo<1>();

// foo.cpp

// #include "foo.h"
// Implementation
template <int x>
void foo()
{}

// Explicit instantiation
template void foo<1>();

```

Compiling:
```
$ clang++ -Wdocumentation -c foo.cpp
foo.cpp:5:6: warning: '\tparam' command used in a comment that is not attached to a template declaration [clang-diagnostic-documentation]
/// \tparam x Some value.
     ^~~~~~
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVEuTmzAM_jXm4kmG2BCWA4c8djs99NTO9OxgAe4Ym8Emm-bXVyZhk7BtZzdjB1mS9fgs6WDl7-JHA5Ss48VPacuhBeOFV9Ygh76K3ihT01odwVFBK6Ed0M465ZFDXxswdLoU9AT10HZaeFQSvWjBQ0-PSgTzfuQgQdiOCiNxUzh1WpXK364p47xAY2MIVEKp8dZIK0cHB3JJ4j2JN9f_dPtNGdUKjaYEmgCS7gl7arzvHOEbwl5w1VYerPZL29d4OuNOsrMwpy_nNWF5ULs3iQGOq-y6K2c0Qitrl82D5sgPohcUzXhzFZLuLgDQE_1uW6BHoQe43nrLnvCdMp6eCH--SI5WyeAZcxpD3b4PgD5PIP4Tu6sbOOFzmBvWb8b5bhU8_sdHSP4GyL2EMK5MqQeJ0TN2AYmxB5Wv4WFudfW5lC-Gsi3J9h_OfebiQ3lOz37P3Nm2UxoL-1YjMzWWUEQZFdgWF521EF2Uj8hNB75Jca9xTy0WSMKytzJBmpa2bUOjhLLHBLG7AgeNU98IHxrCWE-F96JsUMPb-_67bx1skzHKhVSiNtZ5VS4eez3df6pgafiR9Jlkj-tvGEWy4DLnuYi88hqKKRj0SV8e58kcvgDpNYhAfmJaREOvi9kUUL4ZDkuEEA9aH6fPouvtLyg9HpVzAzgkUpZnWdQU8ASQpGWSAmcZK_NVnlSMVwzKisc8lpEWB9Au5IRFfxjqUPo43vBzyZFvqt4aD0YGSbqPVMFixuJVnKxilvF8WcUpT9IqT3m2hpV8IkkMrVB6GWILIyvqizFMtO5QqJXz7iYUzqnawAhrsC8G39i-KEWvrauFPsK5i8a8ijGpPwYRzjw">