Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[class.prop] Clarify definition of implicit-lifetime class #5319

Merged
merged 1 commit into from Jun 24, 2022

Conversation

jensmaurer
Copy link
Member

@jensmaurer jensmaurer commented Feb 24, 2022

Fixes #5318

@jensmaurer jensmaurer added the cwg Issue must be reviewed by CWG. label Feb 24, 2022
@jensmaurer
Copy link
Member Author

It is unclear which semantics were originally intended. CWG should have a look.

@zygoloid
Copy link
Member

zygoloid commented Feb 25, 2022

From P0593R6 section 3.1, the intent was to "permit implicit object creation for aggregate class types even if the aggregate contains an element with a non-trivial destructor".

How about:

A class S is an implicit-lifetime class if either it is an aggregate or it has at least one trivial eligible constructor and a trivial, non-deleted destructor.

... or switching to bullets:

A class S is an implicit-lifetime class if

  • it is an aggregate or
  • it has at least one trivial eligible constructor and a trivial, non-deleted destructor.

@jensmaurer
Copy link
Member Author

@jwakely, P0593R6 section 3.1 is pretty straightforward what is meant here.

I've added bullets to clarify the and/or grouping.

@opensdh
Copy link
Contributor

opensdh commented Jun 17, 2022

@zygoloid: You're certainly right that P0593R6 explicitly mentions "aggregate contains an element with a non-trivial destructor", but that's not the same thing as saying that all aggregates should be allowed, since

struct X {
  Y i;
  ~X();
};

is an aggregate and yet (regardless of the type Y) doesn't satisfy "Destroying an instance of the type runs no code".

@jensmaurer
Copy link
Member Author

CWG telecon 2022-06-17: Approved.

@jensmaurer
Copy link
Member Author

@tkoeppe: CWG has approved this earlier today. Any final thoughts before I merge?

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 24, 2022

Looks great, merge it! Thanks!

@jensmaurer jensmaurer merged commit 3bf6ac5 into cplusplus:main Jun 24, 2022
@jensmaurer jensmaurer deleted the c35 branch June 24, 2022 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[class.prop] ambiguous conditions in definition of implicit-lifetime class
4 participants