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++/6530: GCC 3.0.4 rejects legal code

>Number:         6530
>Category:       c++
>Synopsis:       GCC 3.0.4 rejects legal code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed May 01 06:16:00 PDT 2002
>Originator:     Thomas Koeller
>Release:        3.0.4
System: Linux 2.4.18 #3 Sam Mär 23 01:29:53 CET 2002 i686 unknown
Architecture: i686

host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home/thomas/src/gnu/gcc-3.0.4/configure --prefix=/opt/gcc-v3 --enable-shared --with-gnu-as --with-gnu-ld --enable-threads=posix --enable-languages=c,c++ --with-system-zlib
	A member function of a class is invoked through a function pointer from within a static member
	function of the same class. This is a valid C++ construct, however, the compiler flags it as an

Compile this program:

/* GCC 3.0.4 bug demonstration program */

class A
  void f1(void);
  static void f2(A &c);

void A::f1(void) {}

void A::f2(A &c)
  void (A::*pf)(void);
  pf = &A::f1;

Compiler output:
bugdemo.cxx: In static member function `static void A::f2(A&)':
bugdemo.cxx:15: pointer to member function called, but not in class scope


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