public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10668: nested class looks for member variable rather than object
@ 2003-05-07 17:36 bwood
0 siblings, 0 replies; only message in thread
From: bwood @ 2003-05-07 17:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 10668
>Category: c++
>Synopsis: nested class looks for member variable rather than object
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed May 07 17:36:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Bob Wood (bwood@emc.com)
>Release: gcc-3.2.3
>Organization:
>Environment:
Solaris 8
>Description:
When the attached file is compiled with g++, I get this error:
test.cpp: In constructor 'c1::c2::c2()':
test.cpp:10: 'class c1::c2' has no member named 'i'
If I remove the line commented "remove for success", no error results. Because c1::c2 has no access to c1::i, I would expect the compiler to simply reference the global variable i, as it does when the commented line is removed.
>How-To-Repeat:
g++ test.cpp
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="test.cpp"
Content-Disposition: inline; filename="test.cpp"
int i;
class c1 {
public:
int i;
friend class c2;
class c2 {
public:
int* y;
c2() { y = &i; };
};
c2 z;
};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-05-07 17:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-07 17:36 c++/10668: nested class looks for member variable rather than object bwood
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).