Spot the bug in the Socket wrapper

from RAII
C++23 (GCC 13.3.0) intermediate 4 min 1 issue to find

Find the ownership bug in this generated socket wrapper.

C++
class Socket {
public:
    explicit Socket(int fd) : fd_(fd) {}
    ~Socket() { close_socket(fd_); }
    int get() const { return fd_; }
private:
    int fd_;
};

void send_probe(Socket socket) {
    send_bytes(socket.get(), "ping");
}
Open in playground
Report an error