Skip to content

[clang-tidy] Unclear purpose/usefulness/actionability of portability-template-virtual-member-function #153155

@carlosgalvezp

Description

@carlosgalvezp

I came across the portability-template-virtual-member-function check and don't really understand how the check is useful or actionable. It's not clear as a user what I'm supposed to do to "fix" the code and silence the warning.

The example in the docs shows that there's a compiler error, but that compiler error is not visible in GCC or Clang because the function is not instantiated. It is however visible in MSVC because it is instantiated.

I see two possible scenarios:

  • I only ever use GCC/Clang, then I can just disable the check.
  • I use both GCC/Clang and MSVC, in which case I'll get a compiler error from MSVC, prompting me to fix the compiler error (that goes unnoticed by GCC). Once I fix the compiler error, clang-tidy still complains, even though I've resolved the actual issue.

So I personally do not see the value in this check, it only bans the usage of virtual member functions in class templates. I would vote for removing it altogether, or at the very least improving the docs to show how people are supposed to fix their code to comply with the check.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions