Skip to content

Hide gcc 14 false positive warning

gcc 14 warning "-Wfree-nonheap-object" fires incorrectly in this code:

std::vector<unsigned char> f(std::string const& str) {
    std::vector<unsigned char> buffer;
    buffer.reserve(str.size());
    buffer.emplace_back(0u);
    return buffer;
}

complaining that emplace_back triggers a free of a pointer on the stack.

It's safe to hide the warning as gcc 15 is fixed and does not complain.

Note that this MR only affects the build of LHCb and the effect is only visible in lhcb-lcg-dev4lhcb (where we have a build with gcc14), so there is no point in triggering a ci-test and it's enough to validate with the lhcb-lcg-dev4lhcb slot.

Merge request reports

Loading