|
From: | Hans Aberg |
Subject: | Re: %union with STL |
Date: | Wed, 27 May 2009 14:56:53 +0200 |
On 27 May 2009, at 10:32, Vincent Zweije wrote:
|| So what does the C++ standard say about it?"In a union, at most one of the data members can be active at any time,that is, the value of at most one of the data members can be stored in a union at any time. [...] Each data member is allocated as if it were the sole member of a struct." And for those interested in the problem with the bison union:"An object of a class with a non-trivial constructor (12.1), a non- trivial copy construtor (12.8), a non-trivial destructor (12.4), or a non- trivialcopy assignment operator (13.5.3, 12.8) cannot be a member of a union, nor can an array of such objects."
I saw those, but none of them say anything about pointers - it probably follows from the grammar-like rules in 9.2.
|| Did you see the post by Vincent? And I noticed that std::string appears to be used as well, which needs a #include <string>. :)
I could not reproduce the compile error. If I include the header <string>, I do not need to include <utility>, and if I exclude both or <string>, I get different compiler errors. I did not use a full Bison generated parser, nor "using namespace std".
Hans
[Prev in Thread] | Current Thread | [Next in Thread] |