Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quiet clang warning by adding default move ctor #1821

Merged
merged 1 commit into from
Jul 15, 2019

Conversation

tdp2110
Copy link
Contributor

@tdp2110 tdp2110 commented Jun 26, 2019

clang-8 warns:

../ThirdParty/build/install/include/pybind11/iostream.h:124:5: warning: explicitly defaulted move constructor is implicitly deleted [-Wdefaulted-function-deleted]
    scoped_ostream_redirect(scoped_ostream_redirect&& other) = default;
    ^
../ThirdParty/build/install/include/pybind11/iostream.h:110:23: note: move constructor of 'scoped_ostream_redirect' is implicitly deleted because field 'buffer' has a deleted move constructor
    detail::pythonbuf buffer;
                      ^
../ThirdParty/build/install/include/pybind11/iostream.h:30:29: note: copy constructor of 'pythonbuf' is implicitly deleted because field 'd_buffer' has a deleted copy constructor
    std::unique_ptr<char[]> d_buffer;
                            ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/unique_ptr.h:685:7: note: 'unique_ptr' has been explicitly marked deleted here
      unique_ptr(const unique_ptr&) = delete;
      ^
1 warning generated.

pythonbuf holds a unique_ptr (hence has no copy ctor), and defines a destructor, and hence should have a deleted move ctor (https://en.cppreference.com/w/cpp/language/move_constructor)

@wjakob
Copy link
Member

wjakob commented Jul 15, 2019

LGTM, thanks.

@wjakob wjakob merged commit dffe869 into pybind:master Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants