public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: ncm@cantrip.org
To: gcc-gnats@gcc.gnu.org
Subject: c++/6936: member "using" binds wrong
Date: Wed, 05 Jun 2002 09:46:00 -0000	[thread overview]
Message-ID: <E17Fdth-0001F9-00@ipc> (raw)


>Number:         6936
>Category:       c++
>Synopsis:       member "using" binds wrong
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 05 09:46:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Nathan Myers
>Release:        3.1.1 20020515 (prerelease)
>Organization:
>Environment:
System: Linux ipc 2.4.19-pre4 #3 SMP Fri Mar 29 02:57:10 EST 2002 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.1/configure --enable-languages=c,c++ --enable-threads=posix --prefix=/ncm/gnu-3.1 --enable-concept-checks
>Description:
A member "using" declaration fails to override an inherited matching name.
As a result, in the example below, the compiler reports a type error.

The access-adjustment ("private:") adds a further wrinkle.  According
to the current standard, it should be ignored, and seems to be now, but
if the using-declaration really becomes enough of a declaration to hide
the inherited ``void i()'', it had better not become enough of a 
declaration to be private, too.

>How-To-Repeat:
$ cat /tmp/a.cc
struct Baser { enum { j, i }; };
struct Base : Baser { static void j() {} static void i() {} };
struct Derv : Base  {
  using Baser::j;
private:
  using Baser::i;
};
int k = Derv::j;
int l = Derv::i;

$ g++ -v -c /tmp/a.cc
Reading specs from /ncm/gnu-3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1.1/specs
Configured with: ../gcc-3.1/configure --enable-languages=c,c++ --enable-threads=posix --prefix=/ncm/gnu-3.1 --enable-concept-checks
Thread model: posix
gcc version 3.1.1 20020515 (prerelease)
 /ncm/gnu-3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1.1/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=1 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ /tmp/a.cc -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase a.cc -version -o /tmp/ccIMt85B.s
GNU CPP version 3.1.1 20020515 (prerelease) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.1.1 20020515 (prerelease) (i686-pc-linux-gnu)
        compiled by GNU C version 3.1 20020422 (prerelease).
ignoring nonexistent directory "/ncm/gnu-3.1/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /ncm/gnu-3.1/include/g++-v3
 /ncm/gnu-3.1/include/g++-v3/i686-pc-linux-gnu
 /ncm/gnu-3.1/include/g++-v3/backward
 /usr/local/include
 /ncm/gnu-3.1/include
 /ncm/gnu-3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1.1/include
 /usr/include
End of search list.
/tmp/a.cc:8: invalid conversion from `void (*)()' to `int'
/tmp/a.cc:9: invalid conversion from `void (*)()' to `int'

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


             reply	other threads:[~2002-06-05 16:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-05  9:46 ncm [this message]
2002-10-27  7:16 lerdsuwa

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=E17Fdth-0001F9-00@ipc \
    --to=ncm@cantrip.org \
    --cc=gcc-gnats@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).