warning: ignoring packed attribute because of unpacked non-POD field std::array

When I try to use __attribute__((packed)), the g++ would give me a warning about POD but the packing is still working (checked by gdb) as I enable the __attribute__((packed)).

How can I fix this warning?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  class DataBlock_Offsets {
public:
  uint32_t sma_offset;
  uint32_t data_offset;
  uint32_t string_offset = 0;
  uint32_t dict_offset = 0;
};

template<size_t COLUMN_COUNT>
class DataBlock_Header {
 public:
  uint32_t tuple_count;
  uint64_t stop_offset;
  std::array<DataBlock_Offsets, COLUMN_COUNT> offsets;
  std::array<EncodingType, COLUMN_COUNT> encoding_types;
}
__attribute__((__packed__));


The complete warning from g++ is (assumed in the template parameter is 1):

warning: ignoring packed attribute because of unpacked non-POD field ‘std::array<imlab::util::DataBlock_Offsets, 1> imlab::util::DataBlock_Header<1>::offsets’
std::array<DataBlock_Offsets, COLUMN_COUNT> offsets;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
Last edited on
Topic archived. No new replies allowed.