Closed
Description
Bugzilla Link | 49072 |
Version | trunk |
OS | Windows NT |
CC | @CaseyCarter,@zygoloid |
Extended Description
Consider the following valid TU:
struct TriviallyConstructible {};
struct BadNontrivialClass {
BadNontrivialClass() {}
};
union U {
TriviallyConstructible first{};
BadNontrivialClass second;
};
U u;
Currently clang rejects this with:
<source>:11:3: error: call to implicitly-deleted default constructor of 'U'
U u;
^
<source>:8:24: note: default constructor of 'U' is implicitly deleted because variant field 'second' has a non-trivial default constructor
BadNontrivialClass second;
However, according to the standard (https://eel.is/c++draft/class.union#general-4) the member initializer of first
makes this a valid construct.
Metadata
Metadata
Assignees
Type
Projects
Status
Done