[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
10.1.2 C++ Semantic Values
The %union
directive works as for C, see The Collection of Value Types. In particular it produces a genuine
union
(2), which have a few specific features in C++.
- -
The type
YYSTYPE
is defined but its use is discouraged: rather you should refer to the parser's encapsulated typeyy::parser::semantic_type
. - - Non POD (Plain Old Data) types cannot be used. C++ forbids any instance of classes with constructors in unions: only pointers to such objects are allowed.
Because objects have to be stored via pointers, memory is not
reclaimed automatically: using the %destructor
directive is the
only means to avoid leaks. See section Freeing Discarded Symbols.