Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wdocumentation doesn't work correctly with template parameters #64087

Open
artiomn opened this issue Jul 24, 2023 · 1 comment
Open

-Wdocumentation doesn't work correctly with template parameters #64087

artiomn opened this issue Jul 24, 2023 · 1 comment
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer

Comments

@artiomn
Copy link

artiomn commented Jul 24, 2023

Code:

    /**
     * @brief Find index of an entity type in its variant.
     * @details For example, you can use the method to find an index of a message type in a message variant or an index
     * of a subscription type in a subscription variant.
     * @tparam Variant variant of one or more entity types.
     * @tparam Type entity type to search.
     */
    template <typename Variant, typename Type>
    static constexpr size_t get_type_index = boost::mp11::mp_find<Variant, Type>::value;

CLang result:

In file included from /vsts/agent/_work/2/core/message_bus.h:10:
/vsts/agent/_work/2/core/message_endpoint.h:67:9: warning: '@tparam' command used in a comment that is not attached to a template declaration [-Wdocumentation]
     * @tparam Variant variant of one or more entity types.
        ^~~~~~
/vsts/agent/_work/2/core/message_endpoint.h:68:9: warning: '@tparam' command used in a comment that is not attached to a template declaration [-Wdocumentation]
     * @tparam Type entity type to search.
        ^~~~~~
/vsts/agent/_work/2/core/message_endpoint.h:67:9: warning: '@tparam' command used in a comment that is not attached to a template declaration [-Wdocumentation]
     * @tparam Variant variant of one or more entity types.
        ^~~~~~
/vsts/agent/_work/2/core/message_endpoint.h:68:9: warning: '@tparam' command used in a comment that is not attached to a template declaration [-Wdocumentation]
     * @tparam Type entity type to search.
        ^~~~~~
4 warnings generated.
4 warnings generated.
[ 90%] Linking CXX static library ...library.a
[ 90%] Built target ...-library
gmake: *** [Makefile:156: all] Error 2
@EugeneZelenko EugeneZelenko added clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer and removed new issue labels Jul 24, 2023
@NekkoDroid
Copy link

NekkoDroid commented Jul 26, 2023

I dunno if I should open a separate issue for this or not, but it seems that -Wdocumentation also does not work when on concepts and give the same warning/error for @tparams. (does not have to be a template template, this was just an example I thought of on the spot)

/// @brief Concept ensuring a CRTP class.
/// @tparam T Derived class.
/// @tparam TBase Base CRTP class.
template <typename T, template <typename> typename TBase>
concept IsCRTP = std::derived_from<T, TBase<T>>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Projects
None yet
Development

No branches or pull requests

3 participants