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
TYPE_INFO_DTOR.cpp
Go to the documentation of this file.
1
// checking for type_info dtor
2
3
25
#include "config.h"
26
27
28
#ifndef _RWSTD_NO_HONOR_STD
29
# ifdef _RWSTD_NO_STD_TERMINATE
30
# include "
terminate.h
"
31
# endif
// _RWSTD_NO_STD_TERMINATE
32
#endif
// _RWSTD_NO_HONOR_STD
33
34
35
#ifndef _RWSTD_NO_STD_TYPE_INFO
36
# define NAMESPACE(name) namespace name
37
#else
38
# ifndef _RWSTD_NO_GLOBAL_TYPE_INFO
39
# define NAMESPACE(ignore) extern "C++"
40
# define std
/* empty */
41
# else
42
# ifndef _RWSTD_NO_RUNTIME_IN_STD
43
# define NAMESPACE(name) namespace name
44
# else
45
# define NAMESPACE(ignore) extern "C++"
46
# define std
/* empty */
47
# endif
// _RWSTD_NO_RUNTIME_IN_STD
48
# endif
// _RWSTD_NO_GLOBAL_TYPE_INFO
49
#endif
// _RWSTD_NO_STD_TYPE_INFO
50
51
52
NAMESPACE
(
std
) {
53
54
55
#if defined (__EDG__) || defined (__sgi)
56
// let edg (or some of its derivatives) know about this fake type_info
57
# if !defined (__GNUG__) && !defined (__INTEL_COMPILER)
58
# pragma define_type_info
59
# endif
60
#endif
// __EDG__
61
62
63
struct
type_info
64
{
65
virtual
~type_info
();
66
};
67
68
69
}
// namespace std
70
71
72
struct
B0
:
virtual
std::type_info
{ };
73
struct
B1
:
virtual
std::type_info
{ };
74
75
struct
Derived
:
B0
,
B1
76
{
77
virtual
~Derived
();
78
};
79
80
81
int
dtor
;
82
83
int
main
(
int
argc,
char
*argv[])
84
{
85
// avoid executing the body of main unless explicitly requested
86
// by specifying at least one command line argument (this foils
87
// aggressive optimizers from eliminating the code)
88
(void)&argv;
89
if
(argc < 2)
90
return
0;
91
92
// try to prevent the compiler from optimizing the dtor call away
93
std::type_info
*
ptr
;
94
95
if
(1 < argc)
96
ptr
= (
std::type_info
*)argv[2];
97
else
98
ptr
= (
Derived
*)argv[1];
99
100
// this will most like crash if evaluated but under normal
101
// conditions the function should never reach this far
102
delete
ptr
;
103
104
return
!(1 < argc ? 1 ==
dtor
: 0 ==
dtor
);
105
}
106
107
108
Derived::~Derived
() { ++
dtor
; }
ptr
#define ptr
Definition
17.names.cpp:525
main
#define main
Definition
BAD_ALLOC_COPY_CTOR.cpp:32
dtor
int dtor
Definition
TYPE_INFO_DTOR.cpp:81
NAMESPACE
#define NAMESPACE(name)
Definition
TYPE_INFO_DTOR.cpp:36
std::type_info
Definition
STD_TYPE_INFO.cpp:34
type_info
Definition
GLOBAL_TYPE_INFO.cpp:31
std
Definition
json.h:5363
B0
Definition
TYPE_INFO_DTOR.cpp:72
B1
Definition
TYPE_INFO_DTOR.cpp:73
Derived
Definition
BAD_ALLOC_ASSIGNMENT.cpp:174
Derived::~Derived
virtual ~Derived()
Derived::~Derived
virtual ~Derived()
Definition
BAD_ALLOC_ASSIGNMENT.cpp:477
terminate.h
Generated by
1.9.8