Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
EXTERNAL_HEADERS
RSL
etc
config
src
STD_BAD_TYPEID.cpp
Go to the documentation of this file.
1
// checking for class std::bad_typeid
2
3
25
#include "config.h"
26
27
#ifndef _RWSTD_NO_TYPEINFO
28
# include <typeinfo>
29
#else
30
# ifndef _RWSTD_NO_TYPEINFO_H
31
# include <typeinfo.h>
32
# else
33
34
// 5.2.8, p6 [expr.typeid]:
35
// If the header <typeinfo> is not included prior to a use of typeid,
36
// the program is ill-formed.
37
namespace
std
{
38
39
class
type_info
{ };
40
41
class
bad_typeid
{ };
42
43
}
// namespace std
44
45
# endif
// _RWSTD_NO_TYPEINFO_H
46
#endif
// _RWSTD_NO_TYPEINFO
47
48
49
#if 2 == __GNUG__
50
# ifndef _RWSTD_NO_HONOR_STD
51
# ifdef _RWSTD_NO_STD_TERMINATE
52
# include "
terminate.h
"
53
# endif
// _RWSTD_NO_STD_TERMINATE
54
# endif
// _RWSTD_NO_HONOR_STD
55
#endif
// gcc 2.x
56
57
58
// force a failure if namespace std isn't honored
59
enum
bad_typeid
{ };
60
61
62
struct
S
{
virtual
~S
() { } };
63
64
int
main
()
65
{
66
try
{
67
S
*
s
= 0;
68
69
// throws [std::] bad_typeid
70
typeid
(*s);
71
}
72
catch
(std::bad_typeid&) {
73
return
0;
74
}
75
catch
(...) {
76
// fail if typeid throws anything other than a std::bad_typeid
77
return
1;
78
}
79
80
// fail if typeid doesn't throw
81
return
2;
82
}
s
#define s
Definition
rw_alg_test.h:221
bad_typeid
bad_typeid
Definition
STD_BAD_TYPEID.cpp:59
main
int main()
Definition
STD_BAD_TYPEID.cpp:64
type_info
Definition
GLOBAL_TYPE_INFO.cpp:31
std
Definition
json.h:5363
S
Definition
COLLAPSE_TEMPLATE_STATICS.cpp:40
S::~S
virtual ~S()
Definition
STD_BAD_TYPEID.cpp:62
terminate.h
Generated by
1.9.8