AA struct hashing bug?
Ivan Kazmenko via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Dec 7 17:23:40 PST 2015
On Monday, 7 December 2015 at 22:03:42 UTC, Alex Parrill wrote:
> On Monday, 7 December 2015 at 18:48:18 UTC, Random D user wrote:
>> struct Foo
>> {
>> this( int k )
>> {
>> a = k;
>> }
>> int a;
>> }
>>
>> Foo foo;
>> int[ Foo ] map;
>>
>> map[ foo ] = 1; // Crash! bug?
>>
>> // This also crashes. I believe crash above makes a call like
>> this (or similar) in the rt.
>> //auto h = typeid( foo ).getHash( &foo ); // Crash!
>>
>> win64 & dmd 2.69.2
>
> Also works on DMD v2.069.2 on XUbuntu Linux x64. I can try it
> on Windows later.
>
> Exact code I tested:
>
> struct Foo
> {
> this( int k )
> {
> a = k;
> }
> int a;
> }
>
> void main() {
> Foo foo;
> int[ Foo ] map;
>
> map[ foo ] = 1;
> }
Tested the same code with -m32 and -m64 on Windows. Works for
me, too.
More information about the Digitalmars-d-learn
mailing list