public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6894: lookup of anonymous structure members does not work as in C frontend
@ 2002-06-01 23:57 rth
0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2002-06-01 23:57 UTC (permalink / raw)
To: bernie, gcc-bugs, gcc-prs, nobody
Synopsis: lookup of anonymous structure members does not work as in C frontend
State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Sat Jun 1 23:57:48 2002
State-Changed-Why:
This isn't legal.
struct Bar { struct Foo; };
This is a forward declaration of Bar::Foo, and so doesn't do
what you think it does. Note that this is a Microsoft VC++
extension that we don't support in the C++ front end.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6894
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/6894: lookup of anonymous structure members does not work as in C frontend
@ 2002-06-01 6:36 bernie
0 siblings, 0 replies; 2+ messages in thread
From: bernie @ 2002-06-01 6:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 6894
>Category: c++
>Synopsis: lookup of anonymous structure members does not work as in C frontend
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Sat Jun 01 06:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: bernie@codewiz.org
>Release: gcc-3.1
>Organization:
>Environment:
Linux x86
>Description:
The C frontend has the unnamed fields extension to
allow class-like inheritance by putting an unnamed
structure (the base class) as the first field of
another structure (the derivate class).
The C++ frontend does not reject unnamed fields, but
fails to lookup fields contained within the unnamed structure, making this feature useless.
>How-To-Repeat:
Compile this test case with g++:
#include <stdio.h>
int main(void)
{
struct Foo { int a; };
struct Bar { struct Foo; };
Bar bar;
printf("bar.a = %d", bar.a);
return 0;
}
The reported error is:
foo.cpp:7: `struct main()::Bar' has no member named `a'
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-06-02 6:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-01 23:57 c++/6894: lookup of anonymous structure members does not work as in C frontend rth
-- strict thread matches above, loose matches on Subject: below --
2002-06-01 6:36 bernie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).