[MacPorts] #23604: C++ Destructor of UnicodeString throws exception if local in block with a throw of another exception

MacPorts noreply at macports.org
Mon Feb 8 06:32:06 PST 2010


#23604: C++ Destructor of UnicodeString throws exception if local in block with a
throw of another exception
---------------------------------------+------------------------------------
 Reporter:  bumens@…                   |       Owner:  macports-tickets@…                   
     Type:  defect                     |      Status:  new                                  
 Priority:  Normal                     |   Milestone:                                       
Component:  ports                      |     Version:  1.8.2                                
 Keywords:  icu UnicodeString C++ bug  |        Port:  icu                                  
---------------------------------------+------------------------------------
 {{{
 vb at bayhorse:~/icu-bug % cat test1.cc
 #include <unicode/unistr.h>
 #include <iostream>

 void f() {
     UnicodeString s("");
     throw 23;
 }

 int main(int argc, char **argv) {
     try {
         f();
     }
     catch (...) {
         std::cout << "catched.\n";
     }

     return 0;
 }

 vb at bayhorse:~/icu-bug % cat test2.cc
 #include <unicode/unistr.h>
 #include <iostream>

 void f() {
     { UnicodeString s; }
     throw 23;
 }

 int main(int argc, char **argv) {
     try {
         f();
     }
     catch (...) {
         std::cout << "catched.\n";
     }

     return 0;
 }

 vb at bayhorse:~/icu-bug % make
 g++-mp-4.4 -fexceptions  -L/opt/local/lib -licuuc  test1.cc   -o test1
 g++-mp-4.4 -fexceptions  -L/opt/local/lib -licuuc  test2.cc   -o test2
 vb at bayhorse:~/icu-bug % ./test1
 [1]    66078 abort      ./test1
 vb at bayhorse:~/icu-bug % ./test2
 catched.
 vb at bayhorse:~/icu-bug % uname -a
 Darwin bayhorse.local 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov  3
 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386 i386
 vb at bayhorse:~/icu-bug % g++-mp-4.4 --version
 g++-mp-4.4 (GCC) 4.4.3
 Copyright (C) 2010 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
 PURPOSE.

 vb at bayhorse:~/icu-bug % port installed icu
 The following ports are currently installed:
   icu @4.3.3_0 (active)
 vb at bayhorse:~/icu-bug %
 }}}

-- 
Ticket URL: <http://trac.macports.org/ticket/23604>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list