public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: pcarlini@unitus.it
To: gcc-gnats@gcc.gnu.org
Cc: matzmich@cs.tu-berlin.de
Subject: c++/5659: default access for class/struct bug
Date: Mon, 11 Feb 2002 12:46:00 -0000	[thread overview]
Message-ID: <20020211204100.11240.qmail@sources.redhat.com> (raw)


>Number:         5659
>Category:       c++
>Synopsis:       default access for class/struct bug
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 11 12:46:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Michael Matz / Paolo Carlini
>Release:        g++ (GCC) 3.1 20020209 (experimental)
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
look at this:
---- snip -----
class Outer {
    private:
#if 1
        class Inner;
#else
        struct Inner;
#endif
        Inner *i;
    public:
        void pub();
};

struct Outer::Inner {
    Inner(int i) : mem(i) {}
    int mem;
};

void Outer::pub() { i = new Inner(42); }
---- snap -----

Notice how Outer::Inner is once declared with 'class', once with 'struct',
but defined with 'struct' in evry case.  The current HEAD thinks:

access.cpp:14: `Outer::Inner::Inner(int)' is private
access.cpp:20: within this context

(when it's changed to #if 0 it of course works).  Now the standard says
(if we read it correctly) (11.2), that the default access right of members
depends on the _definition_ not declaration of a class.
>How-To-Repeat:
-gcc3.0.x compiles the testcase just fine, as EDG-based
compilers do.
-In such cases some compilers warn about "inconsistent use
of class/struct keywords". 
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-02-11 20:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-11 12:46 pcarlini [this message]
2002-03-03 14:56 nathan
2002-03-12 12:42 nathan
2002-03-12 15:38 nathan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020211204100.11240.qmail@sources.redhat.com \
    --to=pcarlini@unitus.it \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=matzmich@cs.tu-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).