Skip to content

Null pointer dereference error in boost::bimap::insert() with strict gcc compiler warnings #53

Description

@NilsSei

When compiling code that calls e.g. boost::bimap<int, int>::insert(1, 1) with GCC >=12.1.0 and strict warning flags (-Werror, -Wnull-dereference) and at least -O1, the compiler reports a potential null pointer dereference in std::less::operator(), a false positive.

"error: potential null pointer dereference [-Werror=null-dereference]
{ return __x < __y; }
~~~~^~~~~"

`#include <boost/asio.hpp>
#include <boost/bimap.hpp>

int main()
{
boost::bimap<int, int> map;
map.insert({1, 1});

return 0;
}`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions