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

Commit 51fd8a1

Browse files
authored
Merge pull request #3764 from MartinNowak/merge_stable
merge stable Signed-off-by: Nicholas Wilson <thewilsonator@users.noreply.github.com> Merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2 parents caf14b0 + 6f1692e commit 51fd8a1

File tree

4 files changed

+39
-33
lines changed

4 files changed

+39
-33
lines changed

src/core/memory.d

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,10 @@ void __delete(T)(ref T x) @system
12291229
else static if (is(T == U*, U))
12301230
{
12311231
static if (is(U == struct))
1232-
_destructRecurse(*x);
1232+
{
1233+
if (x)
1234+
_destructRecurse(*x);
1235+
}
12331236
}
12341237
else static if (is(T : E[], E))
12351238
{
@@ -1334,6 +1337,10 @@ unittest
13341337
assert(a is null);
13351338
assert(dtorCalled);
13361339
assert(GC.addrOf(cast(void*) a) == null);
1340+
1341+
// https://issues.dlang.org/show_bug.cgi?id=22779
1342+
A *aptr;
1343+
__delete(aptr);
13371344
}
13381345

13391346
/// Deleting arrays

src/core/stdcpp/exception.d

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ version (GenericBaseException)
6969
{
7070
@nogc:
7171
///
72-
this() nothrow {}
72+
extern(D) this() nothrow {}
7373
///
7474
@weak ~this() nothrow {} // HACK: this should extern, but then we have link errors!
7575

7676
///
7777
@weak const(char)* what() const nothrow { return "unknown"; } // HACK: this should extern, but then we have link errors!
7878

7979
protected:
80-
this(const(char)*, int = 1) nothrow { this(); } // compat with MS derived classes
80+
extern(D) this(const(char)*, int = 1) nothrow { this(); } // compat with MS derived classes
8181
}
8282
}
8383
else version (CppRuntime_DigitalMars)
@@ -87,7 +87,7 @@ else version (CppRuntime_DigitalMars)
8787
{
8888
@nogc:
8989
///
90-
this() nothrow {}
90+
extern(D) this() nothrow {}
9191
//virtual ~this();
9292
void dtor() { } // reserve slot in vtbl[]
9393

@@ -105,7 +105,7 @@ else version (CppRuntime_Microsoft)
105105
{
106106
@nogc:
107107
///
108-
this(const(char)* message = "unknown", int = 1) nothrow { msg = message; }
108+
extern(D) this(const(char)* message = "unknown", int = 1) nothrow { msg = message; }
109109
///
110110
@weak ~this() nothrow {}
111111

@@ -131,7 +131,7 @@ class bad_exception : exception
131131
{
132132
@nogc:
133133
///
134-
this(const(char)* message = "bad exception") { super(message); }
134+
extern(D) this(const(char)* message = "bad exception") nothrow { super(message); }
135135

136136
version (GenericBaseException)
137137
{

src/core/stdcpp/typeinfo.d

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ version (CppRuntime_DigitalMars)
1818
import core.stdcpp.exception;
1919

2020
extern (C++, "std"):
21-
@nogc:
2221

2322
class type_info
2423
{
24+
@nogc:
2525
void* pdata;
2626

2727
public:
@@ -41,17 +41,19 @@ version (CppRuntime_DigitalMars)
4141

4242
class bad_cast : exception
4343
{
44-
this() nothrow { }
45-
this(const bad_cast) nothrow { }
44+
@nogc:
45+
extern(D) this() nothrow { }
46+
extern(D) this(const bad_cast) nothrow { }
4647
//bad_cast operator=(const bad_cast) nothrow { return this; }
4748
//virtual ~this() nothrow;
4849
override const(char)* what() const nothrow;
4950
}
5051

5152
class bad_typeid : exception
5253
{
53-
this() nothrow { }
54-
this(const bad_typeid) nothrow { }
54+
@nogc:
55+
extern(D) this() nothrow { }
56+
extern(D) this(const bad_typeid) nothrow { }
5557
//bad_typeid operator=(const bad_typeid) nothrow { return this; }
5658
//virtual ~this() nothrow;
5759
override const (char)* what() const nothrow;
@@ -62,7 +64,6 @@ else version (CppRuntime_Microsoft)
6264
import core.stdcpp.exception;
6365

6466
extern (C++, "std"):
65-
@nogc:
6667

6768
struct __type_info_node
6869
{
@@ -74,6 +75,7 @@ else version (CppRuntime_Microsoft)
7475

7576
class type_info
7677
{
78+
@nogc:
7779
@weak ~this() nothrow {}
7880
//bool operator==(const type_info rhs) const;
7981
//bool operator!=(const type_info rhs) const;
@@ -88,13 +90,15 @@ else version (CppRuntime_Microsoft)
8890

8991
class bad_cast : exception
9092
{
91-
this(const(char)* msg = "bad cast") @nogc nothrow { super(msg); }
93+
@nogc:
94+
extern(D) this(const(char)* msg = "bad cast") nothrow { super(msg); }
9295
//virtual ~this();
9396
}
9497

9598
class bad_typeid : exception
9699
{
97-
this(const(char)* msg = "bad typeid") @nogc nothrow { super(msg); }
100+
@nogc:
101+
extern(D) this(const(char)* msg = "bad typeid") nothrow { super(msg); }
98102
//virtual ~this();
99103
}
100104
}
@@ -108,10 +112,10 @@ else version (CppRuntime_Gcc)
108112
}
109113

110114
extern (C++, "std"):
111-
@nogc:
112115

113116
abstract class type_info
114117
{
118+
@nogc:
115119
@weak ~this() {}
116120
@weak final const(char)* name() const nothrow
117121
{
@@ -133,19 +137,21 @@ else version (CppRuntime_Gcc)
133137
protected:
134138
const(char)* _name;
135139

136-
this(const(char)* name) { _name = name; }
140+
extern(D) this(const(char)* name) { _name = name; }
137141
}
138142

139143
class bad_cast : exception
140144
{
141-
this() nothrow {}
145+
@nogc:
146+
extern(D) this() nothrow {}
142147
//~this();
143148
@weak override const(char)* what() const nothrow { return "bad cast"; }
144149
}
145150

146151
class bad_typeid : exception
147152
{
148-
this() nothrow {}
153+
@nogc:
154+
extern(D) this() nothrow {}
149155
//~this();
150156
@weak override const(char)* what() const nothrow { return "bad typeid"; }
151157
}
@@ -155,10 +161,10 @@ else version (CppRuntime_Clang)
155161
import core.stdcpp.exception;
156162

157163
extern (C++, "std"):
158-
@nogc:
159164

160165
abstract class type_info
161166
{
167+
@nogc:
162168
@weak ~this() {}
163169
@weak final const(char)* name() const nothrow
164170
{
@@ -173,19 +179,21 @@ else version (CppRuntime_Clang)
173179
protected:
174180
const(char)* __type_name;
175181

176-
this(const(char)* __n) { __type_name = __n; }
182+
extern(D) this(const(char)* __n) { __type_name = __n; }
177183
}
178184

179185
class bad_cast : exception
180186
{
181-
this() nothrow {}
187+
@nogc:
188+
extern(D) this() nothrow {}
182189
//~this();
183190
@weak override const(char)* what() const nothrow { return "bad cast"; }
184191
}
185192

186193
class bad_typeid : exception
187194
{
188-
this() nothrow {}
195+
@nogc:
196+
extern(D) this() nothrow {}
189197
//~this();
190198
@weak override const(char)* what() const nothrow { return "bad typeid"; }
191199
}

src/object.d

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,17 +1885,8 @@ class TypeInfo_Struct : TypeInfo
18851885
return false;
18861886
else if (xopEquals)
18871887
{
1888-
// TODO: remove as soon as `git describe` for DMD master yields v2.099+
1889-
static if (__VERSION__ < 2099)
1890-
{
1891-
const dg = _memberFunc(p2, xopEquals);
1892-
return dg.xopEquals(p1);
1893-
}
1894-
else
1895-
{
1896-
const dg = _memberFunc(p1, xopEquals);
1897-
return dg.xopEquals(p2);
1898-
}
1888+
const dg = _memberFunc(p1, xopEquals);
1889+
return dg.xopEquals(p2);
18991890
}
19001891
else if (p1 == p2)
19011892
return true;

0 commit comments

Comments
 (0)