Skip to content

Make basic_process default constructor =delete'd#563

Merged
klemens-morgenstern merged 1 commit into
boostorg:developfrom
sjoubert:fix/process-default-ctor
Jul 23, 2026
Merged

Make basic_process default constructor =delete'd#563
klemens-morgenstern merged 1 commit into
boostorg:developfrom
sjoubert:fix/process-default-ctor

Conversation

@sjoubert

Copy link
Copy Markdown
Contributor

The basic_process defaulted default constructor fails to compiles and since it is NOT expected to be default constructible this marks it as such and removes the misleading comment

Fixes #562

The basic_process defaulted default constructor fails to compiles and
since it is *NOT* expected to be default constructible this marks it as
such and removes the misleading comment

Fixes boostorg#562
@klemens-morgenstern

Copy link
Copy Markdown
Collaborator

Are you telling me that a defaulted default constructor is not expected to be deleted?

@klemens-morgenstern
klemens-morgenstern merged commit a3d1090 into boostorg:develop Jul 23, 2026
16 of 25 checks passed
@sjoubert

Copy link
Copy Markdown
Contributor Author

Are you telling me that a defaulted default constructor is not expected to be deleted?

A defaulted constructor tells the compiler to automatically synthesize its definition when it needs one. In this case, it will fail to do so because a sub-object is not default constructible itself, but that could depend on the template parameter,... The semantic meaning conveyed by a defaulted implementation is that it is an available method, if you want to prevent or document non-usage explicitly that's what = delete is for.

Here in practice we could probably also just remove the default constructor. Since there are other constructors, omitting the no argument one will prevent it from being made available by the compiler implicitly. But deleting it explicitly makes is very clear to users, through the compiler error message, that it's non-availability is intentional (versus a "no matching constructor found, see the following 3 billions template constructors")

@sjoubert
sjoubert deleted the fix/process-default-ctor branch July 23, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The process class is not default constructible as expected from documentation

2 participants