Add type-safe bitfield enums, use them for SPTYP_*.

enum_bitfield<E> holds a bitwise or of enumerators of the enum E.  It
allows combining Es with | and &, while preventing mixing in arbitrary
integers (or enumerators of the wrong enum).  The class converts to an
integer of the appropriate type.  The function bitfield() constructs an
enum_bitfield of the appropriate type without having to specify the
template parameter (much as make_pair() does for class pair<S,T>).

See 035df76 for an example of the type of problem this is intended
to prevent.

Unfortunately, an enum_bitfield cannot be initialised with FLAG_FOO |
FLAG_BAR, as that is just an integer and would defeat type safety.
Instead, initialise with one of:

   { FLAG_FOO, FLAG_BAR, FLAG_BAZ }
   bitfield(FLAG_FOO, FLAG_BAR, FLAG_BAZ)
   bitfield(FLAG_FOO) | FLAG_BAR | FLAG_BAZ

Note that bitfield(FLAG_FOO) | OTHERFLAG_FUM (where OTHERFLAG_FUM
belongs to another enum) is still legal; however, it gives an int
of some sort and not an enum_bitfield, so cannot be used to initialise
an enum_bitfield.

TODO: make as much of the class as possible constexpr so there is no
added runtime cost (in particular, for the multi-argument constructor,
which currently uses nested delegated constructors).
Make some spell type functions more type-strict.

It would be nice if there were a more type-safe way to iterate over
all the enumerators.