Opened 18 years ago

Closed 18 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:

Description

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 by david_abrahams, 18 years ago

Status: assignedclosed
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.
Note: See TracTickets for help on using tickets.