Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 103ca0c

Browse files
ibuclawdlang-bot
authored andcommitted
core.stdcpp.typeinfo: Add implementation of typeinfo for CppRuntime_Clang
1 parent 3909793 commit 103ca0c

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/core/stdcpp/typeinfo.d

+39
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,44 @@ else version (CppRuntime_Gcc)
145145
@weak override const(char)* what() const;
146146
}
147147
}
148+
else version (CppRuntime_Clang)
149+
{
150+
import core.stdcpp.exception;
151+
152+
extern (C++, "std"):
153+
154+
abstract class type_info
155+
{
156+
@weak ~this() {}
157+
@weak final const(char)* name() const nothrow
158+
{
159+
return __type_name;
160+
}
161+
@weak final bool before(const type_info __arg) const nothrow
162+
{
163+
return __type_name < __arg.__type_name;
164+
}
165+
//bool operator==(const type_info) const;
166+
167+
protected:
168+
const(char)* __type_name;
169+
170+
extern(D) this(const(char)* __n) { __type_name = __n; }
171+
}
172+
173+
class bad_cast : exception
174+
{
175+
this();
176+
//~this();
177+
@weak override const(char)* what() const;
178+
}
179+
180+
class bad_typeid : exception
181+
{
182+
this();
183+
//~this();
184+
@weak override const(char)* what() const;
185+
}
186+
}
148187
else
149188
static assert(0, "Missing std::type_info binding for this platform");

0 commit comments

Comments
 (0)