@@ -70,12 +70,12 @@ else version (CppRuntime_Microsoft)
70
70
71
71
class type_info
72
72
{
73
- // virtual ~this();
74
- void dtor () { } // reserve slot in vtbl[]
73
+ @nogc :
74
+ extern ( D ) ~this () nothrow {}
75
75
// bool operator==(const type_info rhs) const;
76
76
// bool operator!=(const type_info rhs) const;
77
- final bool before (const type_info rhs) const ;
78
- final const (char )* name (__type_info_node* p = &__type_info_root_node) const ;
77
+ final bool before (const type_info rhs) const nothrow ;
78
+ final const (char )* name (__type_info_node* p = &__type_info_root_node) const nothrow ;
79
79
80
80
private :
81
81
void * pdata;
@@ -85,14 +85,12 @@ else version (CppRuntime_Microsoft)
85
85
86
86
class bad_cast : exception
87
87
{
88
- this (const (char )* msg = " bad cast" );
89
- // virtual ~this();
88
+ extern (D ) this (const (char )* msg = " bad cast" ) @nogc nothrow { super (msg); }
90
89
}
91
90
92
91
class bad_typeid : exception
93
92
{
94
- this (const (char )* msg = " bad typeid" );
95
- // virtual ~this();
93
+ extern (D ) this (const (char )* msg = " bad typeid" ) @nogc nothrow { super (msg); }
96
94
}
97
95
}
98
96
else version (CppRuntime_Gcc )
@@ -108,39 +106,47 @@ else version (CppRuntime_Gcc)
108
106
109
107
class type_info
110
108
{
111
- void dtor1 (); // consume destructor slot in vtbl[]
112
- void dtor2 (); // consume destructor slot in vtbl[]
113
- final const (char )* name ()() const nothrow {
109
+ @nogc :
110
+ extern (D ):
111
+ ~this () {}
112
+ final const (char )* name ()() const nothrow
113
+ {
114
114
return _name[0 ] == ' *' ? _name + 1 : _name;
115
115
}
116
- final bool before ()(const type_info _arg) const {
116
+ final bool before ()(const type_info _arg) const nothrow
117
+ {
117
118
import core.stdc.string : strcmp;
118
119
return (_name[0 ] == ' *' && _arg._name[0 ] == ' *' )
119
120
? _name < _arg._name
120
121
: strcmp(_name, _arg._name) < 0 ;
121
122
}
122
123
// bool operator==(const type_info) const;
123
- bool __is_pointer_p () const ;
124
- bool __is_function_p () const ;
125
- bool __do_catch (const type_info, void ** , uint ) const ;
126
- bool __do_upcast (const __class_type_info, void ** ) const ;
124
+ // dummy implementations to populate the D vtable:
125
+ bool __is_pointer_p () const { assert (0 ); }
126
+ bool __is_function_p () const { assert (0 ); };
127
+ bool __do_catch (const type_info, void ** , uint ) const { assert (0 ); };
128
+ bool __do_upcast (const __class_type_info, void ** ) const { assert (0 ); };
127
129
130
+ protected :
128
131
const (char )* _name;
129
- this (const (char )* );
132
+
133
+ this (const (char )* name) { _name = name; }
130
134
}
131
135
132
136
class bad_cast : exception
133
137
{
134
- this ();
135
- // ~this();
136
- override const (char )* what () const ;
138
+ @nogc :
139
+ extern (D ):
140
+ this () nothrow {}
141
+ override const (char )* what () const nothrow { return " bad cast" ; }
137
142
}
138
143
139
144
class bad_typeid : exception
140
145
{
141
- this ();
142
- // ~this();
143
- override const (char )* what () const ;
146
+ @nogc :
147
+ extern (D ):
148
+ this () nothrow {}
149
+ override const (char )* what () const nothrow { return " bad typeid" ; }
144
150
}
145
151
}
146
152
else
0 commit comments