This is the mail archive of the gcc-prs@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++/105: Re: Bug in exception handling and virtual inheritance



>Number:         105
>Category:       c++
>Synopsis:       Bug in exception handling and virtual inheritance
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          analyzed
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 14 01:26:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Rafael Jesus Alcantara Perez <rafa@dedalo-ing.com>
>Release:        2.95.2
>Organization:
>Environment:
>Description:
 Date: Mon, 13 Mar 2000 13:56:32 +0100
 Original-Message-Id: <00031313585000.01880@odisea.home.ma.es>

 [code crashes when catching exceptions involving virtual inheritance
 - MvL]

>How-To-Repeat:
#include <string>
#include <iostream>


class TA
{

  protected:

    std::string   yMessage;


  public:

    TA (void)    :
      yMessage() 
    {
      cerr << this << ":\tTA::TA (void)\n";
    }

    TA (const char* pkcSOURCE) :
      yMessage (pkcSOURCE)
    {
      cerr << this << ":\tTA::TA (" << pkcSOURCE << ")\n";
    }

    TA (const TA& rktSOURCE)        :
      yMessage (rktSOURCE.yMessage)
    {
      cerr << this << ":\tTA::TA[C] (" << yMessage << ")\n";
    }

    ~TA (void)
    {
      cerr << this << ":\t~TA::TA (" << yMessage << ")\n";
    }

    std::string what (void) const
    {
      return yMessage;
    }

};  // class TA


class TB1 : public virtual TA {};
class TB2 : public virtual TA {};


class TC            :
  public virtual TA ,
  public TB1        ,
  public TB2
{

  public:

    TC (const char* pkcSOURCE) :
      TA  (pkcSOURCE)          ,
      TB1 ()                   ,
      TB2 ()                   {}

};  // class TC


int main (void)
{

  try
  {
    throw TC ("TC");
  }
  catch (const TA& rktSOURCE_EXCEPTION)
  {
    ;
  }
  return 0;
  
}  // main()
>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]