public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/8577: postfix operator not inherithed
@ 2002-11-20  9:25 nathan
  0 siblings, 0 replies; 3+ messages in thread
From: nathan @ 2002-11-20  9:25 UTC (permalink / raw)
  To: Delana.Lorenzo, gcc-bugs, gcc-prs, nobody

Synopsis: postfix operator not inherithed

State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Thu Nov 14 00:37:57 2002
State-Changed-Why:
    not a bug. B's operator++ function hides those of the base.
    You need a using declaration.

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


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

* Re: c++/8577: postfix operator not inherithed
@ 2002-11-20 17:57 Gabriel Dos Reis
  0 siblings, 0 replies; 3+ messages in thread
From: Gabriel Dos Reis @ 2002-11-20 17:57 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/8577; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: Delana.Lorenzo@libero.it
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/8577: postfix operator not inherithed
Date: 14 Nov 2002 15:06:02 +0100

 Delana.Lorenzo@libero.it writes:
 
 [...]
 
 | >Class:          sw-bug
 
 This is not a bug.
 
 [...]
 
 | class A
 | {
 | public:
 | virtual void toimplement () = 0;
 | void implemented () { toimplement(); }
 | virtual void operator ++ () = 0;
 | void operator ++ (int) { printf ("Postfix inc\n"); }
 | };
 | 
 | class B : public A {
 | public:
 | void toimplement () { printf ("IMPLEMENTATION of pure\n"); }
 | void operator ++ () { printf ("Prefix inc\n"); }
        ^^^^^^^^^^^
 
 This hides the name of the postfix function in A.
 
 In short: don't overload a virtual function.
 
 -- Gaby


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

* c++/8577: postfix operator not inherithed
@ 2002-11-20  7:31 Delana.Lorenzo
  0 siblings, 0 replies; 3+ messages in thread
From: Delana.Lorenzo @ 2002-11-20  7:31 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8577
>Category:       c++
>Synopsis:       postfix operator not inherithed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 13 22:46:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Delana.Lorenzo@libero.it
>Release:        gcc-3.2
>Organization:
>Environment:
Linux
>Description:
#include <iostream>
using namespace std;

class A
{
public:
virtual void toimplement () = 0;
void implemented () { toimplement(); }
virtual void operator ++ () = 0;
void operator ++ (int) { printf ("Postfix inc\n"); }
};

class B : public A {
public:
void toimplement () { printf ("IMPLEMENTATION of pure\n"); }
void operator ++ () { printf ("Prefix inc\n"); }
};

int
main ()
{
  B b;
b.implemented ();
++b;
b++; // b not inherit the implemented A baseclass level postfix operator
}
>How-To-Repeat:
compile simple source code
>Fix:

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


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-20  9:25 c++/8577: postfix operator not inherithed nathan
  -- strict thread matches above, loose matches on Subject: below --
2002-11-20 17:57 Gabriel Dos Reis
2002-11-20  7:31 Delana.Lorenzo

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