Require trivial destructor in allocate_on_obstack

This patch makes allocate_on_obstack a little bit safer, by enforcing
the rule that objects allocated on an obstack must have a trivial
destructor.

The static assert is done in a method -- doing it inside the class
itself won't work because the class is incomplete at that point.
This commit is contained in:
Tom Tromey
2024-02-26 10:19:07 -07:00
parent 9069d69398
commit 7f032bbedf
7 changed files with 12 additions and 8 deletions

View File

@@ -105,7 +105,7 @@ struct blockranges
This implies that within the body of one function
the blocks appear in the order of a depth-first tree walk. */
struct block : public allocate_on_obstack
struct block : public allocate_on_obstack<block>
{
/* Return this block's start address. */
CORE_ADDR start () const