c++/6936: member "using" binds wrong
ncm@cantrip.org
ncm@cantrip.org
Wed Jun 5 09:46:00 GMT 2002
>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:
More information about the Gcc-bugs
mailing list