skypjack / uvw

Header-only, event based, tiny and easy to use libuv wrapper in modern C++ - now available as also shared/static library!
MIT License
1.84k stars 209 forks source link

PollHandle's private fd masks Handle's fd() #236

Closed jagerman closed 3 years ago

jagerman commented 3 years ago

PollHandle has a private fd member, but this masks the base class's fd() method, and so the following does not compile:

#include <uvw.hpp>
#include <iostream>

int main() {
    auto loop = uvw::Loop::getDefault();
    auto poll = loop->resource<uvw::PollHandle>(1);
    std::cerr << poll->fd() << "\n";
}

with:

foo.cpp:8:24: error: 'fd' is a private member of 'uvw::PollHandle'
    std::cerr << poll->fd() << "\n";
                       ^
src/uvw/poll.h:132:13: note: declared private here
        int fd;
            ^

I can still get at with this ugliness:

    std::cerr << poll->uvw::Handle<uvw::PollHandle, uv_poll_t>::fd() << "\n";

but that's gross.

skypjack commented 3 years ago

Aha, good catch! 👍 Thanks.

skypjack commented 3 years ago

Can I ask you to repeat the test on branch experimental before merging into master? Thanks.

jagerman commented 3 years ago

Can I ask you to repeat the test on branch experimental before merging into master? Thanks.

Confirmed, that fixes it. Thanks!

skypjack commented 3 years ago

Great. Thank you for checking it.