This is consistent with what is done with yacc.c and glr.c. Because
it also avoids that the stack needs to be resized very soon, it should
help keeping tests about destructors more reliable.
Indeed, if the stack is created too small, very soon the C++ library
needs to enlarge it, which means creating a new one, copying the
elements from the initial one onto it, and then destroy the elements
of the initial stack: that would be a spurious call to a destructor.
Reported by Thomas Jahns.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00059.html
* data/stack.hh (stack::stack): Reserve 200 slots.
* tests/c++.at: Remove traces of stack expansions.
stack ()
: seq_ ()
{
+ seq_.reserve (200);
}
stack (unsigned int n)
: seq_ (n)
- {
- }
+ {}
inline
T&
slice (const S& stack, unsigned int range)
: stack_ (stack)
, range_ (range)
- {
- }
+ {}
inline
const T&
]],
[[Destroy: ""
Destroy: "0"
-Destroy: (0)
Destroy: 1
Destroy: "1"
Destroy: ()