C++ Logo

std-proposals

Advanced search

Re: [std-proposals] User-Defined Trivial Constructors

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Sat, 10 Jan 2026 21:45:34 -0500
On Sat, Jan 10, 2026 at 3:03 PM Jody Hagins <coachhagins_at_[hidden]> wrote:

> [...]
>
I'm confused about what you are asking me to prove. If I
> understand correctly, my only evidence is that the standard currently makes
> those assertions.
>

I'd say that "the standard currently makes those assertions" is the *claim*;
in the paper as presented you didn't give the evidence *for* that claim —
which would be to quote (or at least to identify) the passages you're
intending to introduce as evidence, and showing the logical links that lead
you from the evidence to the claim (except optionally in cases where those
links are super obvious).

[...] The actual problem nests, kinda like swiss cheese. Because, you can
> have this...
> ```c++
> struct Foo
> {
> Bar bar;
> Baz baz;
> };
> static_assert(std::is_implicit_lifetime_type_v<Bar>);
> static_assert(std::is_implicit_lifetime_type_v<Baz>);
> static_assert(not std::is_implicit_lifetime_type_v<Foo>);
> ```
> The only way that Foo will be an implicit lifetime type under the current
> definition is if both Bar and Baz have at least one trivial constructor IN
> COMMON.
>

No, *that* claim I *can* show to be incorrect. Here `Foo` is 100%
definitely an aggregate ([dcl.init.aggr]/1
<https://eel.is/c++draft/dcl.init.aggr#:aggregate>), and therefore an
implicit-lifetime class ([class.prop]/8
<https://eel.is/c++draft/class.prop#8>):

> A class S is an *implicit-lifetime class* if
> - it is an aggregate whose destructor is not user-provided or

- it has at least one trivial eligible constructor and a trivial,
> non-deleted destructor.

and therefore an implicit-lifetime type ([basic.types.general]/9
<https://eel.is/c++draft/basic.types.general#9.sentence-4>):

> Scalar types, implicit-lifetime class types, array types, and *cv*-qualified
> versions of these types are collectively called *implicit-lifetime types*.


Really I should dig one level deeper, to prove that `Foo` has no
user-provided destructor; but that is unduly difficult because
[dcl.fct.def.default]/5
<https://eel.is/c++draft/dcl.fct.def.default#5.sentence-4> defines
"user-provided" in terms of "user-declared" and I can't find a normative
definition of "user-declared."
<https://github.com/cplusplus/draft/issues/8703>

(By "chapter-and-verse" I meant references like [dcl.init.aggr]/1
<https://eel.is/c++draft/dcl.init.aggr#:aggregate>, [class.prop]/8
<https://eel.is/c++draft/class.prop#8>, [basic.types.general]/9
<https://eel.is/c++draft/basic.types.general#9.sentence-4>.)

Enjoy your Christmas (Observed), :)
Arthur

Received on 2026-01-11 02:45:48