This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/10496: erroneus suggestion in diagnostic and possible bug
- From: benko at sztaki dot hu
- To: gcc-gnats at gcc dot gnu dot org
- Date: 25 Apr 2003 13:07:51 -0000
- Subject: c++/10496: erroneus suggestion in diagnostic and possible bug
- Reply-to: benko at sztaki dot hu
>Number: 10496
>Category: c++
>Synopsis: erroneus suggestion in diagnostic and possible bug
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Apr 25 13:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: benko at sztaki dot hu
>Release: 3.2.3
>Organization:
>Environment:
Linux arta 2.4.18 #2 Thu Feb 28 19:27:45 CET 2002 i686 unknown
>Description:
Given the following program:
arta:~/c/proba$ cat ptr2mem.cc
struct a
{
int f() const;
};
int
a::f() const
{
int (a::* b)() const = &a::f;
}
arta:~/c/proba$ g++3 -v
Reading specs from /gml/shared/gcc-3.2.3/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/specs
Configured with: ../gcc-3.2.3/configure --prefix=/gml/shared/gcc-3.2.3
Thread model: posix
gcc version 3.2.3
arta:~/c/proba$ g++3 ptr2mem.cc
ptr2mem.cc: In member function `int a::f() const':
ptr2mem.cc:10: ISO C++ forbids taking the address of an unqualified non-static
member function to form a pointer to member function. Say `&const a::f'
zsh: exit 1 g++3 ptr2mem.cc
arta:~/c/proba$
I think &f should be enough, but &const a::f
(as suggested by the diagnostics) is refused by g++
(I think rightly so).
(&a::f is accepted.)
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: