Commit eadeea59 authored by Kenton Varda's avatar Kenton Varda Committed by GitHub

Merge pull request #568 from ecatmur/vla-empty

Variable-length arrays must have positive bound.
parents 065181a1 55832a08
......@@ -261,7 +261,7 @@ KJ_NORETURN(void unreachable());
#define KJ_STACK_ARRAY(type, name, size, minStack, maxStack) \
size_t name##_size = (size); \
bool name##_isOnStack = name##_size <= (maxStack); \
type name##_stack[name##_isOnStack ? size : 0]; \
type name##_stack[kj::max(1, name##_isOnStack ? name##_size : 0)]; \
::kj::Array<type> name##_heap = name##_isOnStack ? \
nullptr : kj::heapArray<type>(name##_size); \
::kj::ArrayPtr<type> name = name##_isOnStack ? \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment