Issue 63804
Summary Clang incorrectly tries to call the destructor of anonymous unions
Labels clang:frontend, rejects-valid
Assignees
Reporter cor3ntin
    Clang rejects this valid C++ code

struct S{
    ~S() {}
};

struct A {
    union {
        S arr_;
    };
 ~A(); // user-provided!
};

auto foo() {
    return A{S()};
}

https://godbolt.org/z/oqWYGnzf9

Clang complains that the destructor of the union is implicitly deleted, but destructors of anonymous unions should not be called (per http://eel.is/c++draft/class.dtor#13) or exist.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to