-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
cert-dcl58-cpp flags legitimate specializations (false positive) #45454
Comments
You're also allowed to specialize Here's the clause: https://eel.is/c++draft/numbers#math.constants-2 |
Probably should extend the check to work with constexpr variable templates |
It could be that the tool has been updated and fixed this compared to the version I had on my machine. I'll see if I can reproduce with more recent clang-tidy. |
The issue no longer reproduces in clang-tidy 14, so I'm closing. |
Please reopen, it still fails (15.0-rc2) for templated objects:
|
I can confirm @Febbe's case, I'm also getting that warning on a partial specialization as of 15.0.0. It seems to have started in 15 actually, I wasn't getting it in 14. There were changes made to this warning in 15, seemingly with the goal of allowing full specializations, which do work - but partial ones are throwing out the false positive now. |
Just giving this a bump because I've run into the same issue of false positives on partial specializations on version 16.0.4. |
Re-enable this check and suppress the false-positives it was producing. The issue regarding these false-positives can be found at llvm/llvm-project#45454 Once that is fixed these suppressions can be removed.
Re-enable this check and suppress the false-positives it was producing. The issue regarding these false-positives can be found at llvm/llvm-project#45454 Once that is fixed these suppressions can be removed.
Just ran into the same issue (I think), trying to add structured binding support to a class template, Affected code: namespace std
{
template <unsigned int VImageDimension>
struct tuple_size<itk::ImageRegion<VImageDimension>> : std::integral_constant<size_t, 2>
{};
template <size_t VTupleIndex, unsigned int VImageDimension>
struct tuple_element<VTupleIndex, itk::ImageRegion<VImageDimension>>
: conditional<VTupleIndex == 0, itk::Index<VImageDimension>, itk::Size<VImageDimension>>
{};
} Clang Tidy output from Visual Studio 2019, Clang Power Tools 2023.9.0, LLVM 17.0.1:
...
Hope it can still be fixed. Otherwise, do you have a suggestion how to work around this warning, in user code? |
It's a bug in the checkers code. So if someone has time, he could always write a fix and open a PR. |
Currently //NOLINT(cert-dcl58-cpp) or //NOLINTNEXTLINE(cert-dcl58-cpp) as an workaround |
Extended Description
You're allowed to inject specializations of std::hash into namespace std for your own types.
https://en.cppreference.com/w/cpp/utility/hash
The text was updated successfully, but these errors were encountered: