public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6530: GCC 3.0.4 rejects legal code
@ 2002-06-05  8:14 lerdsuwa
  0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2002-06-05  8:14 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, thomas

Synopsis: GCC 3.0.4 rejects legal code

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Wed Jun  5 08:14:44 2002
State-Changed-Why:
    Not a bug.  The function call operator has higher precedence
    than the member selection .* operator.  So your code actually
    means
      c.*(pf());

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6530


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/6530: GCC 3.0.4 rejects legal code
@ 2002-05-01  6:16 thomas
  0 siblings, 0 replies; 2+ messages in thread
From: thomas @ 2002-05-01  6:16 UTC (permalink / raw)
  To: gcc-gnats; +Cc: thomas

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1457 bytes --]


>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
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Koeller
>Release:        3.0.4
>Organization:
>Environment:
System: Linux sarkovy.koeller.dyndns.org 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
>Description:
	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
	error.

>How-To-Repeat:
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;
  c.*pf();
}



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

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-06-05 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-05  8:14 c++/6530: GCC 3.0.4 rejects legal code lerdsuwa
  -- strict thread matches above, loose matches on Subject: below --
2002-05-01  6:16 thomas

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).