Skip to content

[clang] False Negative: -Wsign-compare not triggered on instantiated templates #109631

@carlosgalvezp

Description

@carlosgalvezp

Example:

#include <cstdint>

template <typename T>
struct Foo
{
    static constexpr T size{123};
};

void f()
{
    std::int32_t foo{123};
    std::uint32_t bar{321U};
    auto x = foo == bar;                        // OK, -Wsign-compare triggered
    auto y = foo == Foo<std::uint32_t>::size;   // NOK, no warnings
}

https://godbolt.org/z/355WMh6hz

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerfalse-negativeWarning doesn't fire when it shouldquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions