2

clang compile fail, but not g++

/Users/xx/xxx/xxxx/common/src/memorychunkpn.hpp:438:28: error: constexpr variable 'nOff' must be initialized by a constant expression
            constexpr auto nOff = (size_t)(uintptr_t)(&((*((InnMemoryChunk *)(0))).Data[0]));

InnMemoryChunk:

  typedef struct _InnMemoryChunk{
  bool In;            // this to indicate the chunk is allocated in the memory pool
                      // actually we can compare pointer range to decide

  size_t NodeID;      // node in its memory pool, use it for offset calculation
  size_t PoolID;      //
  size_t BranchID;    //

  uint8_t Data[4];    // offset to the data field, size is always ok
}InnMemoryChunk;

Anyone could help please?

Baum mit Augen
  • 49,044
  • 25
  • 144
  • 182
ryancheung
  • 2,999
  • 3
  • 24
  • 25

0 Answers0