[swift-dev] SILNode versus C++

David Zarzycki dave at znu.io
Sat Dec 16 08:08:48 CST 2017


I’m trying to improve SILNode memory layout density by adopting the AST bitfield macros. Unfortunately, multiple inheritance doesn’t seem to get along with anonymous/unnamed unions. Here is a distillation of the problem:

class B {
    int i;
    union { int j; };

class X : public B { };
class Y : public B { };

class Z : public X, public Y {
    int a() { return X::i; } // works
    int b() { return X::j; } // fails

Is this expected C++ behavior? I can certainly workaround this by naming the unnamed union, but before I do, I thought that I should check here first.


More information about the swift-dev mailing list