On Mon, Mar 10, 2025 at 05:34:40PM +0100, Richard Biener wrote:
> Building gcobol with GCC 7 shows
>
> gcc/cobol/except.cc:285:70: sorry, unimplemented: non-trivial
> designated initializers not supported
>
> that needs to be sorted out (post-merge is OK).
cbl_field_data_t data = { .memsize = capacity_cast(len),
.capacity = capacity_cast(len),
.initial = reinterpret_cast<char*>(blob),
.picture = reinterpret_cast<char*>(blob) };
given
struct cbl_field_data_t {
uint32_t memsize; // nonzero if larger subsequent redefining field
uint32_t capacity, // allocated space
digits; // magnitude: total digits (or characters)
int32_t rdigits; // digits to the right
const char *initial, *picture;
...
};
Designated initializers are C++20, so you should just avoid that. So,
I'd recommend just:
cbl_field_data_t data = { /* memsize= */capacity_cast(len),
/* capacity= */capacity_cast(len),
/* digits= */0,
/* rdigits= */0,
/* initial= */reinterpret_cast<char*>(blob),
/* picture= */reinterpret_cast<char*>(blob) };
Jakub