https://bugs.llvm.org/show_bug.cgi?id=43762

            Bug ID: 43762
           Summary: Invalid active union member change
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

The following should not compile:

class A {
public:
    int x = 1;
    constexpr virtual int f() = 0;
};

class B : public A {
public:
    int y = 1;
    constexpr virtual int f() override { return 1; }
};


union U {
    int n;
    B b;
};

constexpr int test() {
    U u { .n = 5 };
    u.b.x = 10;
    return u.b.f();
}

static_assert(test());

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to