Modify

Opened 13 years ago

Closed 13 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;
}

Attachments (0)

Change History (1)

comment:1 Changed 13 years ago by david_abrahams

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as deleted The owner will remain nobody.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.