Bug 32162 - G++ barfs on anonymous union
Summary: G++ barfs on anonymous union
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-03-18 23:01 UTC by Ralph Loader
Modified: 2007-04-18 16:32 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-03-26 16:27:02 UTC
Embargoed:


Attachments (Terms of Use)

Description Ralph Loader 2001-03-18 23:01:06 UTC
The follow code incorrectly fails to compile with G++ 2.96-78:

#include <string>

struct AStruct
{
   union {
      int a;
   };
   std::string str;
};

AStruct global;

void Foo (const AStruct & other)
{
   global = other;
}

The error is:

temp.cc: In method `AStruct &AStruct::operator= (const AStruct &)':
temp.cc:7: `AStruct::{anonymous union} &AStruct::{anonymous
union}::operator= (const AStruct::{anonymous union} &)' is inaccessible
temp.cc:15: within this context

Comment 1 Jakub Jelinek 2001-03-26 16:26:24 UTC
I've fixed this last thursday in CVS gcc, the fix will be included in
gcc-c++-2.96-80.

Comment 2 Jakub Jelinek 2001-03-26 16:26:58 UTC
Oh, just FYI, the patch is at
http://gcc.gnu.org/ml/gcc-patches/2001-03/msg01620.html


Note You need to log in before you can comment on or make changes to this bug.