Opened 14 years ago

Closed 14 years ago

#291 deleted Support Requests (None)

with constructor not allowed in union

Reported by: nobody Owned by: nobody
Milestone: Component: None
Version: None Severity:
Keywords: Cc:


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;

Change History (1)

comment:1 Changed 14 years ago by david_abrahams

Status: assignedclosed
Logged In: YES 

This isn't, and never was, a Boost-related issue.  Please bring 
it up in a general C++ forum.  Suggestion: comp.lang.c++ or 
Note: See TracTickets for help on using tickets.