c++/597: C++ bug in anonymous struct support
fgouget@codeweavers.com
fgouget@codeweavers.com
Tue Oct 3 23:46:00 GMT 2000
>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:
More information about the Gcc-bugs
mailing list