Search code examples
c++g++type-traits

assertion fails: __is_complete_or_unbounded array with size 0


While compiling HHVM, the code fails due to:

/usr/include/c++/10/type_traits:918:52: error: non-constant condition for static assertion
  918 |       static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),

What does __is_complete_or_unbounded actually do/check?

The issue occurs while constructing an object whose last member variable is as follows:

  value_type cell[0]

The constructor does not initialize this member, is this the problem? How would I initialize the value_type variable?


Solution

  • In C++, an array cannot have zero size.

    From Array declarators documentation:

    If the expression is a constant expression, it shall have a value greater than zero.