"I2::i" 在多重继承中格式错误吗?

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

我问了关于 的问题。我的回答解释 B::i 格式正确。

但是,我在 c++ 中找到 open-std 文档,其中 I2::i 格式错误的

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

那么,我的 是真的吗?

你没看对。看下面的文字:

In my proposed wording, the class of "this" can't be converted to "B" (the qualifier is ignored), so the access is ill-formed. Oops.

I think the following is a correct formulation, so the proposed resolution we discuss in Sydney should contain the following paragraph instead of the one in N1543:

    If E2 is a nonstatic data member or a non-static member function, the program is ill-formed if the naming class (11.2) of E2 cannot be unambiguously converted (10.2) to the class of which E2 is directly a member.

该示例表明早先提议的措辞存在问题。这是一个专门给出的例子,因为它应该是有效的,以防止它被无效。

链接的问题指出,一个特定的提案使引用的代码格式错误。它似乎在说,这是一个论点,即该特定提案的确切形式存在缺陷,其目的是改进该提案,使其不再破坏该代码。在提案的最终版本N1626中,这个例子没有出现。将 N1626 合并到 C++11 标准中似乎已经解决了这个问题(我不知道为什么它没有在该页面上标记为已解决)。所以不,引用的代码不会变成病态的。