Issue 52977
Summary [clang] False positive -Wdocumentation + tparam + explicit template instantiation declaration
Labels bug, clang:frontend
Assignees
Reporter carlosgalvezp
    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.
     ^~~~~~
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to