错误:constexpr变量'nOff'必须由常量表达式初始化

时间:2017-12-22 13:20:25

标签: c++

clang编译失败,但不是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;

有人可以帮忙吗?

0 个答案:

没有答案