This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

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



>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:


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