From 7149012fc641d8873d02a52f6c4823d53a340164 Mon Sep 17 00:00:00 2001 From: kinke Date: Fri, 9 Dec 2016 20:07:50 +0100 Subject: [PATCH] [MSVCRT] core.stdcpp.typeinfo: Don't implement exception ctors Implementing them (wrongly btw, ignoring the msg) leads to an implicit call to the `super` ctor of base class `core.stdcpp.exception.std.exception`, which is only declared in D. Even if the ctor signature was correct (see below), it's mangled differently (see https://github.com/dlang/dmd/pull/5884), so there'd be an unresolved external anyway. So don't implement it, just declare it (also done for Glibc) to defer the linking error. Quality-wise, the 2 `core.stdcpp` modules are at most at an alpha stage for MSVCRT. Other issues I've noted so far using **VS 2015**: * The signature of the `core.stdcpp.exception.std.exception.this()` ctor is wrong. There's no default, i.e., parameter-less one, only `std::exception::exception(const char *_Message = "unknown", int x=1)`. * `std::exception` only contains a pointer, no additional `bool` field. * The signature of `core.stdcpp.typeinfo.std.type_info.name()` is wrong. It doesn't take any arguments. The first 2 aren't crucial, as these C++ exceptions are most likely never constructed on the D side. But the last one will need to be fixed. @rainers: Which VS versions does DMD currently support? --- src/core/stdcpp/typeinfo.d | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/core/stdcpp/typeinfo.d b/src/core/stdcpp/typeinfo.d index a535dbf802..f6c0c20f8b 100644 --- a/src/core/stdcpp/typeinfo.d +++ b/src/core/stdcpp/typeinfo.d @@ -71,8 +71,6 @@ else version (CRuntime_Microsoft) { class type_info { - - public: //virtual ~this(); void dtor() { } // reserve slot in vtbl[] //bool operator==(const type_info rhs) const; @@ -83,21 +81,18 @@ else version (CRuntime_Microsoft) private: void* pdata; char[1] _name; - //this(const type_info rhs); //type_info operator=(const type_info rhs); } class bad_cast : core.stdcpp.exception.std.exception { - this(const(char)* msg = "bad cast") { } - this(const bad_cast) { } + this(const(char)* msg = "bad cast"); //virtual ~this(); } class bad_typeid : core.stdcpp.exception.std.exception { - this(const(char)* msg = "bad typeid") { } - this(const bad_typeid) { } + this(const(char)* msg = "bad typeid"); //virtual ~this(); } }