Skip to content

Warnings about shadowed members #1267

@dhaumann

Description

@dhaumann

Issue description

Compiling under Linux, we get many warnings of the following form:

pybind11/detail/common.h(782): warning #1944: declaration of "v" shadows a member of 'this'
the shadowed declaration is at line 764
    any_container(std::vector<T> &&v) : v(std::move(v)) { }

pybind11/detail/common.h(782): warning #3280: declaration hides member "pybind11::detail::any_container<T>::v" (declared at line 764)
  any_container(std::vector<T> &&v) : v(std::move(v)) { }

pybind11/buffer_info.h(28): warning #1944: declaration of "ptr" shadows a member of 'this'
the shadowed declaration is at line 18
  buffer_info(void *ptr, ssize_t itemsize, const std::string &format, ssize_t ndim,

pybind11/buffer_info.h(28): warning #3280: declaration hides member "pybind11::buffer_info::ptr" (declared at line 18)
  buffer_info(void *ptr, ssize_t itemsize, const std::string &format, ssize_t ndim,

pybind11/buffer_info.h(28): warning #1944: declaration of "itemsize" shadows a member of 'this'
        the shadowed declaration is at line 19
  buffer_info(void *ptr, ssize_t itemsize, const std::string &format, ssize_t ndim,

pybind11/buffer_info.h(28): warning #3280: declaration hides member "pybind11::buffer_info::itemsize" (declared at line 19)
  buffer_info(void *ptr, ssize_t itemsize, const std::string &format, ssize_t ndim,

...and many more...

Would it be possible to get this fixed, or what is the best practice here?

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