This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/597: C++ bug in anonymous struct support
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/597: C++ bug in anonymous struct support
- From: fgouget at codeweavers dot com
- Date: 4 Oct 2000 06:39:59 -0000
- Reply-To: fgouget at codeweavers dot com
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, jason at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, fgouget@codeweavers.com
>Number: 597
>Category: c++
>Synopsis: C++ bug in anonymous struct support
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Oct 03 23:46:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: fgouget@codeweavers.com
>Release: gcc 2.96: cvs as of 2000/10/02
>Organization:
>Environment:
>Description:
g++ reports an error when encountering a construct
of the form 'struct anon;'.
On the program given as an example the error message is:
$ g++ -c foo.cpp
foo.cpp: In function `int main()':
foo.cpp:28: `struct anon_struct2' has no member named `a'
foo.cpp:29: `struct anon_struct2' has no member named `b'
The example program compiles fine with gcc. It could
easily be adapted to test both anonymous struct and union
support both in C and C++.
>How-To-Repeat:
Compile the following file:
struct nested {
int a;
int b;
};
struct anon_struct1 {
struct {
int a;
int b;
};
int c;
};
struct anon_struct2 {
struct nested;
int c;
};
int main()
{
struct anon_struct1 v1;
struct anon_struct2 v2;
v1.a=1;
v1.b=2;
v1.c=3;
v2.a=1;
v2.b=2;
v2.c=3;
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: