Fix using constructor that is unavailable in C++11 #168
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
According to cppreference.com, the vector constructor
vector( size_type count, const Allocator& alloc = Allocator() )
without init value but with allocator that is used here was only introduced in C++14. Since we only compile with C++11, this was caught correctly by LLVM's libc++ (see #166). It only enables this constructor for C++14 and greater: https://github.com/llvm/llvm-project/blob/f39c38584eb762702a651e87e63162c9bc4842a3/libcxx/include/vector#L425-L427Minimal example: https://godbolt.org/z/WqnWPdoK1 vs. https://godbolt.org/z/sq9srsb8P
GNUs stdlibc++ seems to just silently (and wrongfully) provide this constructor even on C++11, hiding this issue until now.
To fix this, provide the init value 0 explicitly to call the
vector( size_type count, const T& value = T(), const Allocator& alloc = Allocator() )
constructor that is provided by C++11. Fixes #166