-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
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
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Type
Projects
Status
Done