FreeBSD Bugzilla – Attachment 131379 Details for
Bug 175453
Catching C++ std::bad_cast doesn't work in FreeBSD 9.1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
file.txt
file.txt (text/plain), 445 bytes, created by
Hongli Lai
on 2013-01-20 17:00:00 UTC
(
hide
)
Description:
file.txt
Filename:
MIME Type:
Creator:
Hongli Lai
Created:
2013-01-20 17:00:00 UTC
Size:
445 bytes
patch
obsolete
>#include <exception> >#include <typeinfo> >#include <stdio.h> > >class foo { >public: > virtual ~foo() {} >}; > >class bar: public foo { >public: > int val; > bar(): val(123) {} >}; > >static void >cast_test(const foo &f) { > try { > const bar &b = dynamic_cast<const bar &>(f); > printf("%d\n", b.val); > } catch (const std::bad_cast &) { > printf("bad cast\n"); > } >} > >int main() { > foo f; > cast_test(f); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 175453
: 131379