Boost C++ Libraries: Ticket #291: with constructor not allowed in union https://svn.boost.org/trac10/ticket/291 <pre class="wiki">I get error - with '..' constructor not allowed in union, when I compile the following code in gcc. Any method for overcoming this kind of problem. The code is like this. Struct X { union ut1 { struct st1 { int i1; long l1; } s1; struct st2 { char c1; double d1; } s2; X() {} // g++ gives error if constructor is present. }; Struct Y { int i; union ut3 { X x; // member 'X Y::ut3::x' with constructor // not allowed in union. int i1; } u3; Y () { i = 0; } }; int main() { Y y; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/291 Trac 1.4.3 david_abrahams Sat, 24 Jul 2004 15:02:35 GMT status changed https://svn.boost.org/trac10/ticket/291#comment:1 https://svn.boost.org/trac10/ticket/291#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=52572 This isn't, and never was, a Boost-related issue. Please bring it up in a general C++ forum. Suggestion: comp.lang.c++ or comp.lang.c++.moderated. </pre> Ticket