Skip to content

Providing default constructors for structs breaks use of designated initializers #329

Closed
@ianabel

Description

Using Sundials in a C++20 program results in no clean way to instantiate custom SUNLinearSolvers (and other obejcts).

The usual

struct _generic_SUNLinearSolver_Ops LSOps =·
{
.gettype = SunLinSolWrapper::LSGetType,
.getid = SunLinSolWrapper::LSGetID,
.setatimes = nullptr, ...
};

Isn't permitted because the default constructor makes _generic_SUNLinearSolver_Ops a non-aggregate type.

From include/sundials/sundials_linearsolver.h:127

#ifdef __cplusplus
  _generic_SUNLinearSolver_Ops() = default;
#endif

Removing this default constructor results in a pure aggregate type and declaring the default constructor should not be necessary.

I know this is low priority, but flagging this as usage of C++20 will only increase.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions