RedDocMD marked an inline comment as done. RedDocMD added inline comments.
================ Comment at: clang/test/Analysis/reinterpret-cast-pointer-to-member.cpp:43-50 +struct A {}; +struct B : public A {}; +struct C { + int field; +}; +struct D : public C {}; +struct E : public B, public D {}; ---------------- steakhal wrote: > An ASCII art would help so much: > ``` > A C(field) > | | > B D > \ / > E > | > F > ``` > However, I'm still missing a diamond-shaped inheritance. > An ASCII art would help so much: > ``` > A C(field) > | | > B D > \ / > E > | > F > ``` > However, I'm still missing a diamond-shaped inheritance. Thanks for the ASCII art! The diamond-shaped inheritance as far as I understood will cause illegal code. Eg: ``` A | B / \ C D \ / E ``` According to my understanding, if I have a field in A or B, and try to define a member pointer like `int E::* ef = &A::field`, it is not allowed. On GCC, this is the error message I get: ``` struct A { int field; }; struct B : public A {}; struct C : public virtual B {}; struct D : public virtual B {}; struct E : public C, public D {}; int main() { int E::* ef1 = &A::field; } ``` diamond-member-pointer.cpp: In function ‘int main()’: diamond-member-pointer.cpp:11:22: error: pointer to member conversion via virtual base ‘B’ 11 | int E::* ef1 = &A::field; | ^~~~~ ``` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D96976/new/ https://reviews.llvm.org/D96976 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits