This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ pointer to member regression (?)


since a few days (can't say for sure for how long), g++ 3.4-branch and
mainline refuse to compile the code below:

struct foo
  int f1(int) const;

template<typename T> struct bar: public foo
  void func()
    typedef int (foo::*fptr)(int) const;
    fptr ptr = &foo::f1;

~/tmp>g++ -c -v
Reading specs from /afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/3.5.0/specs
Configured with: /scratch/gcc/configure --quiet --prefix=/afs/mpa/data/martin/ugcc --enable-languages=c++,f95 --with-gmp=/afs/mpa/data/martin/mygmp
Thread model: posix
gcc version 3.5.0 20040608 (experimental)
 /afs/mpa/data/martin/ugcc/libexec/gcc/i686-pc-linux-gnu/3.5.0/cc1plus -quiet -v -D_GNU_SOURCE -quiet -dumpbase -mtune=pentiumpro -auxbase pmemb -version -o /tmp/ccj0fNsd.s
ignoring nonexistent directory "/afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/3.5.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
End of search list.
GNU C++ version 3.5.0 20040608 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 3.5.0 20040608 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 In member function `void bar<T>::func()': error: invalid use of ' foo::f1' to form a pointer-to-member-function.  Use a qualified-id.

g++ 3.3 (as well as several other compilers) compiles this without complaint.
I'm not a pointer-to-member expert, so I cannot tell for sure which compiler
is right. If there is agreement that this is a bug, I'll file it in Bugzilla.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]