public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "harald at gigawatt dot nl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/19377] Using declaration in "private" part causes "protected" diagnostic
Date: Sat, 08 Feb 2014 08:44:00 -0000	[thread overview]
Message-ID: <bug-19377-4-Ke0HSu0aIE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-19377-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19377

Harald van Dijk <harald at gigawatt dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harald at gigawatt dot nl

--- Comment #12 from Harald van Dijk <harald at gigawatt dot nl> ---
Fabien, are you sure that the test case in comment 9 is invalid? C++11 reads

"In a using-declaration used as a member-declaration, the nested-name-specifier
shall name a base class of the class being defined. If such a using-declaration
names a constructor, the nested-name-specifier shall name a direct base class
of the class being defined; otherwise it introduces the set of declarations
found by member name lookup (10.2, 3.4.3.1)."

which makes sense: any inherited member, even from an indirect base class, can
be introduced into the current class, except for an indirect base class's
constructor.

As for "It is invalid for a second reason, 'using Base::i' is declared
(implicitly) in a private section, so inaccessible in DerivedDerived.", the
DerivedDerived using declaration uses a fully qualified ns::Base::i, the
visibility of which should depend on the visibility in Base, not the visibility
in Derived. If the code used ns::Derived::i, then it would make sense to issue
an error, and clang does emit an error in that case.

As for being separate from this bug, a trivial change of that test case to

namespace ns {
  class Base {
  protected:
    int i;
  };
  class Derived : public Base {
    using Base::i;
  };
}
class DerivedDerived : public ns::Derived {
  using ns::Base::i;
};

makes GCC emit

test.cc:4:9: error: ‘int ns::Base::i’ is protected
     int i;
         ^
test.cc:11:7: error: within this context
 class DerivedDerived : public ns::Derived {
       ^

which is exactly the error message that this bug is about. Similarly, changing
the "protected:" to "public:" in the original test case changes the error
message from "protected" to "inaccessible".
>From gcc-bugs-return-443026-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Feb 08 08:45:44 2014
Return-Path: <gcc-bugs-return-443026-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30195 invoked by alias); 8 Feb 2014 08:45:44 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 30161 invoked by uid 48); 8 Feb 2014 08:45:39 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/60116] [4.8/4.9 Regression] wrong code at -Os on x86_64-linux-gnu in 32-bit mode
Date: Sat, 08 Feb 2014 08:45:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: glisse at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cf_gcctarget bug_status cf_reconfirmed_on component target_milestone short_desc everconfirmed
Message-ID: <bug-60116-4-bw7gnAcTZH@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60116-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60116-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-02/txt/msg00783.txt.bz2
Content-length: 975

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`116

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |i386-linux-gnu
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-02-08
          Component|tree-optimization           |rtl-optimization
   Target Milestone|---                         |4.9.0
            Summary|wrong code at -Os on        |[4.8/4.9 Regression] wrong
                   |x86_64-linux-gnu in 32-bit  |code at -Os on
                   |mode                        |x86_64-linux-gnu in 32-bit
                   |                            |mode
     Ever confirmed|0                           |1

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
.optimized dump looks ok to me, so either RTL or target.


  parent reply	other threads:[~2014-02-08  8:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-19377-4@http.gcc.gnu.org/bugzilla/>
2010-11-12 15:08 ` fabien at gcc dot gnu.org
2011-11-27 21:44 ` fabien at gcc dot gnu.org
2012-04-15 17:11 ` manu at gcc dot gnu.org
2012-04-15 17:18 ` pinskia at gcc dot gnu.org
2012-04-15 17:42 ` manu at gcc dot gnu.org
2012-04-15 18:24 ` fabien at gcc dot gnu.org
2014-02-06 14:22 ` abel at gcc dot gnu.org
2014-02-06 16:20 ` fabien at gcc dot gnu.org
2014-02-07  5:12 ` abel at gcc dot gnu.org
2014-02-08  8:44 ` harald at gigawatt dot nl [this message]
2014-02-08 15:57 ` redi at gcc dot gnu.org
2021-01-29 12:22 ` anthonysharp15 at gmail dot com
2021-04-28 18:48 ` anthonysharp15 at gmail dot com
2005-01-11 16:25 [Bug c++/19377] New: " redi at gcc dot gnu dot org
2005-01-11 17:08 ` [Bug c++/19377] " pinskia at gcc dot gnu dot org
2005-01-12 10:46 ` lerdsuwa at gcc dot gnu dot org
2005-05-01  3:34 ` pinskia at gcc dot gnu dot org

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=bug-19377-4-Ke0HSu0aIE@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).