Skip to content

-Wdocumentation misleading diagnostic with template specialzation #144775

Open
@oliverlee

Description

@oliverlee
#include <type_traits>

/// @brief brief
/// @tparam T type
template <class T, class = void>
constexpr auto var = T{};

/// @brief brief
/// @tparam T integral type
template <class T>
constexpr auto var<T, std::enable_if_t<std::is_integral_v<T>>> = T{}
<source>:9:6: warning: '@tparam' command used in a comment that is not attached to a template declaration [-Wdocumentation]
    9 | /// @tparam T integral type
      |      ^~~~~~
1 warning generated.

https://godbolt.org/z/Gx9bfYf4W

The documentation is still useful in the specialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions