Search code examples
c++c++11inheritancemultiple-inheritance

Is "I2::i" ill-formed in multiple inheritance?


I asked question about Multiple inheritance to avoid ambiguity by using scope resolution . Where my answer explained B::i is well-formed.

But, I found in c++ open-std document, Where I2::i is ill-formed.

struct D2: I1, I2 {
        void f() {
            I2::i = 0;    // ill-formed per proposal
        }
    };

So, Is my answer true?


Solution

  • The linked issue points out that a particular proposal makes the quoted code ill-formed. It appears to be saying that this is an argument that the exact form of that particular proposal is flawed, and the intent was to improve the proposal so that it no longer breaks that code. In the final version of the proposal N1626, this example does not appear. The merging of N1626 into the C++11 standard appears to have resolved this issue (I don't know why it isn't marked as resolved on that page). So no, the quoted code is not going to become ill-formed.