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]
Other format: [Raw text]

[Bug optimization/14535] [3.3/3.4/3.5 Regression] exception throwing in virtual function doesn't turn on the local destructors


------- Additional Comments From bangerth at dealii dot org  2004-03-11 16:19 -------
Confirmed indeed. Here is something more selfcontained: 
--------------------- 
extern "C" void abort(); 
bool destructor_called = false; 
 
struct B { 
    virtual void Run(){}; 
}; 
 
struct D : public B { 
    virtual void Run() 
      { 
        struct O { 
            ~O() { destructor_called = true; }; 
        } o; 
         
        struct Raiser { 
            Raiser()  throw( int ) {throw 1;}; 
        } raiser; 
      }; 
}; 
 
int main() { 
    try { 
      D d; 
      static_cast<B&>(d).Run(); 
    } catch (...) {} 
 
    if (!destructor_called) 
      abort (); 
} 
----------------------- 
 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ x.cc ; ./a.out 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -finline x.cc ; ./a.out 
Aborted 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.4.0 3.3.1 3.5.0 tree-ssa  |3.4.0 3.3.1 3.5.0 tree-ssa
                   |                            |3.2.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535


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