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

            Bug ID: 89976
           Summary: missing uninitialized warning: laundering via passing
                    object through a function
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nok.raven at gmail dot com
  Target Milestone: ---

// case 1 - https://godbolt.org/z/02zu_3

struct X
{
    int x, y;
    X() : y(0) {}
};

X foo()
{
    X x;
    return x;
}

int main()
{
    X x = foo();
    return x.x;
}

// case 2 - https://godbolt.org/z/ev4Fs4

struct X
{
    int x;
};

struct Y : X
{
    int y;
    Y() {}
};

Y foo()
{
    Y x;
    return x;
}

int main()
{
    Y x = foo();
    return x.x;
}

// case 3 - https://godbolt.org/z/LZvtcU

struct X
{
    int x;
};

struct Y
{
    Y() {}
};

struct Z : X, Y
{
    int z;
};

Z foo()
{
    Z x;
    return x;
}

int main()
{
    Z x = foo();
    return x.x;
}

Reply via email to