pybind / pybind/pybind11

Warnings about shadowed members

Open
#1,267 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
18k
Forks
2.3k
Avg merge
5d 17h
Merged PRs (30d)
10

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling under Linux and inspect the reported declarations in pybind11/detail/common.h and pybind11/buffer_info.h. Identify the remaining shadowed-member warnings across the affected headers, then verify that the warnings are eliminated without changing the binding behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.