Skip to content

Commit e588ec4

Browse files
WalterBrightdlang-bot
authored andcommitted
Object.getHash() shouldn't be casting away const
1 parent bdeee86 commit e588ec4

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

src/core/thread/fiber.d

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,14 +603,9 @@ class Fiber
603603
*/
604604
this( void delegate() dg, size_t sz = PAGESIZE * defaultStackPages,
605605
size_t guardPageSize = PAGESIZE ) nothrow
606-
in
607-
{
608-
assert( dg );
609-
}
610-
do
611606
{
612607
allocStack( sz, guardPageSize );
613-
reset( dg );
608+
reset( cast(void delegate() const) dg );
614609
}
615610

616611

src/core/thread/threadbase.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class ThreadBase
105105
m_call = fn;
106106
}
107107

108-
this(void delegate() dg, size_t sz = 0) @safe pure nothrow @nogc
109-
in(dg)
108+
this(void delegate() dg, size_t sz = 0) @trusted pure nothrow @nogc
109+
in( cast(void delegate() const) dg)
110110
{
111111
this(sz);
112112
m_call = dg;

src/object.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ class TypeInfo_Delegate : TypeInfo
14811481

14821482
override size_t getHash(scope const void* p) @trusted const
14831483
{
1484-
return hashOf(*cast(void delegate()*)p);
1484+
return hashOf(*cast(void delegate() const *)p);
14851485
}
14861486

14871487
override bool equals(in void* p1, in void* p2) const

0 commit comments

Comments
 (0)