Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Apr 2008 10:29:05 -0700
From:      Ted Faber <faber@ISI.EDU>
To:        Yuri <yuri@rawbw.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: C++ exceptions are broken in FreeBSD with gcc-compiled code?
Message-ID:  <20080409172905.GA33086@zod.isi.edu>
In-Reply-To: <47FCF12D.3070902@rawbw.com>
References:  <47FCF12D.3070902@rawbw.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Wed, Apr 09, 2008 at 09:39:09AM -0700, Yuri wrote:
> I am unable to make a C++ program to catch an exception using the the 
> system g++ compiler.
> 
> > cat exc.C
> #include <iostream>
> #include <string>
> using namespace std;
> 
> int main() {
>  try {
>    throw string("String");
>  } catch (string s) {
>    cout << "Caught an exception \"" << s << "\"\n";
>  }
> }
> 
> 
> * Failed attempts with system compiler (using /lib/libgcc_s.so.1 and 

FYI it works here:

zod:~$ cat > test.cc
#include <iostream>
#include <string>
using namespace std;

int main() {
 try {
   throw string("String");
 } catch (string s) {
   cout << "Caught an exception \"" << s << "\"\n";
 }
}
zod:~$ g++ test.cc 
zod:~$ ./a.out
Caught an exception "String"
zod:~$ g++ -v 
Using built-in specs.
Target: i386-undermydesk-freebsd
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 4.2.1 20070719  [FreeBSD]
zod:~$ uname -a
FreeBSD zod.isi.edu 8.0-CURRENT FreeBSD 8.0-CURRENT #5: Tue Apr  1
13:00:38 PDT 2008     root@zod.isi.edu:/usr/obj/usr/src/sys/ZOD  i386


-- 
Ted Faber
http://www.isi.edu/~faber           PGP: http://www.isi.edu/~faber/pubkeys.asc
Unexpected attachment on this mail? See http://www.isi.edu/~faber/FAQ.html#SIG

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.8 (FreeBSD)

iEYEARECAAYFAkf8/OEACgkQaUz3f+Zf+XsPIQCg/FvDoXieoFihPmnb5JaO/VWp
EZUAoPP+LInURskze68jdW0bKTaWlc7G
=Hilr
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080409172905.GA33086>