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

Commit 8180486

Browse files
n8shdlang-bot
authored andcommitted
Fix Issue 21441 - TypeInfo_Enum.destroy and TypeInfo_Enum.postblit not calling destroy and postblit of base type
Also offTi but as that does not seem to be implemented yet mentioning it in the change log would be confusing.
1 parent f3a4326 commit 8180486

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

src/object.d

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,9 @@ class TypeInfo_Enum : TypeInfo
459459

460460
override @property inout(TypeInfo) next() nothrow pure inout { return base.next; }
461461
override @property uint flags() nothrow pure const { return base.flags; }
462+
override const(OffsetTypeInfo)[] offTi() const { return base.offTi; }
463+
override void destroy(void* p) const { return base.destroy(p); }
464+
override void postblit(void* p) const { return base.postblit(p); }
462465

463466
override const(void)[] initializer() const
464467
{

test/typeinfo/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include ../common.mak
22

3-
TESTS:=comparison isbaseof
3+
TESTS:=comparison isbaseof enum_
44

55
.PHONY: all clean
66
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))

test/typeinfo/src/enum_.d

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// https://issues.dlang.org/show_bug.cgi?id=21441
2+
3+
int dtorCount;
4+
int postblitCount;
5+
6+
struct S
7+
{
8+
this(this) { ++postblitCount; }
9+
~this() { ++dtorCount; }
10+
}
11+
12+
enum E : S { _ = S.init }
13+
14+
void main()
15+
{
16+
E e;
17+
typeid(e).destroy(&e);
18+
assert(dtorCount == 1);
19+
typeid(e).postblit(&e);
20+
assert(postblitCount == 1);
21+
}

0 commit comments

Comments
 (0)