mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 09:25:51 +00:00
7fb01ecd9c
Under gcc 7 with -std=c++11, compilation results in several of the following warnings: In file included from /home/jagerman/src/pybind11/tests/test_sequences_and_iterators.cpp:13:0: /home/jagerman/src/pybind11/include/pybind11/operators.h: In function ‘pybind11::detail::op_<(pybind11::detail::op_id)0, (pybind11::detail::op_type)0, pybind11::detail::self_t, pybind11::detail::self_t> pybind11::detail::operator+(const pybind11::detail::self_t&, const pybind11::detail::self_t&)’: /home/jagerman/src/pybind11/include/pybind11/operators.h:78:76: warning: inline declaration of ‘pybind11::detail::op_<(pybind11::detail::op_id)0, (pybind11::detail::op_type)0, pybind11::detail::self_t, pybind11::detail::self_t> pybind11::detail::operator+(const pybind11::detail::self_t&, const pybind11::detail::self_t&)’ follows declaration with attribute noinline [-Wattributes] inline op_<op_##id, op_l, self_t, self_t> op(const self_t &, const self_t &) { \ ^ /home/jagerman/src/pybind11/include/pybind11/operators.h:109:1: note: in expansion of macro ‘PYBIND11_BINARY_OPERATOR’ PYBIND11_BINARY_OPERATOR(add, radd, operator+, l + r) ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /home/jagerman/src/pybind11/include/pybind11/cast.h:15:0, from /home/jagerman/src/pybind11/include/pybind11/attr.h:13, from /home/jagerman/src/pybind11/include/pybind11/pybind11.h:36, from /home/jagerman/src/pybind11/tests/pybind11_tests.h:2, from /home/jagerman/src/pybind11/tests/test_sequences_and_iterators.cpp:11: /home/jagerman/src/pybind11/include/pybind11/descr.h:116:36: note: previous definition of ‘pybind11::detail::descr pybind11::detail::operator+(pybind11::detail::descr&&, pybind11::detail::descr&&)’ was here PYBIND11_NOINLINE descr friend operator+(descr &&d1, descr &&d2) { ^~~~~~~~ This appears to be happening because gcc is considering implicit construction of `descr` in some places using addition of two `descr`-compatible arguments in the `descr.h` c++11 fallback code. There's no particular reason that this operator needs to be a friend function: this commit changes it to an rvalue-context member function operator, which avoids the warning. |
||
---|---|---|
.. | ||
pybind11 |