Warning about uninitialized members in initializer list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Consider the following example:

class A {
public:
    int i;
    A(int _i) : i(_i) {}
};

class B : public A {
public:
    B(int _i) : A(i) {} // bug, should be A(_i) or shadowing B(int i)
};

I'm assuming this calls for undefined behavior, as i is uninitialized.
Would it be reasonable to ask for a warning in this case?

-Mike Rolish

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux