c++/2202: g++ accept to throw object of class with pure virtual member

bourguet@cadence.com bourguet@cadence.com
Wed Mar 7 04:36:00 GMT 2001


>Number:         2202
>Category:       c++
>Synopsis:       g++ accept to throw object of class with pure virtual member
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 07 04:36:02 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     bourguet@cadence.com
>Release:        code sourcery snapshot
>Organization:
>Environment:

>Description:
This is accepted by the current snapshot,

class foo {
public:
  foo() {};
  void throwMe () {
    throw *this;
  };
  virtual void test () = 0;
};

As far as I know, this code should be refused as it is not
possible to create a temporary of type foo for throwing
*this (foo has a pure virtual member function test).

Previous version of g++ (2.8.2) rejected the code as does
the other compilers I've access to (comeau online driver,
IBM xlC, HP aCC) except SparcWorks.

-- Jean-Marc
>How-To-Repeat:

>Fix:

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



More information about the Gcc-bugs mailing list