Hello!
I have the following function
std::tuple<uint32_t, uint8_t> getRawIdx(uint16_t tidx) {
return std::make_tuple(localidx.entries[tidx].indx_ptr,
localidx.entries[tidx].indx_size);
}
Where s is a struct like
typedef struct __attribute__((packed)) {
uint32_t indx_ptr;
uint8_t indx_size;
} _i_idx_entry ;
The error I get is:
cannot bind packed field
‘((DBIndex*)this)->DBIndex::localidx.DBIndex::_i_idx::entries[((int)tidx)].DBIndex::_i_idx_entry::indx_ptr’
to ‘unsigned int&’
If extend the tuple to include a 3rd field and I return some other thing
it just works:
return std::make_tuple(localidx.entries[tidx].indx_ptr,
localidx.entries[tidx].indx_size,
tidx, prefb);
I think gcc is trying to do some smart optimization or something and
packed does not work because of tuple alignments not being packed.
Any ideas?
Thanks!
David