https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109941

--- Comment #4 from Roy Jacobson <roi.jacobson1 at gmail dot com> ---
The linked bug is about nodiscard applied to the class together with ignoring
temporary objects. But GCC will when the type is the return value or when the
nodiscard is applied to the constructor:

class [[nodiscard]] err {};
err f();

void g() {
    f(); // Warning emitted
}

struct RAII {
    [[nodiscard]] RAII(int x);
};

void h() {
    RAII(0); // Warning emitted
}

Reply via email to