www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15111] New: hashOf fails for structs that are also ranges

https://issues.dlang.org/show_bug.cgi?id=15111

          Issue ID: 15111
           Summary: hashOf fails for structs that are also ranges
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: GenericNPC gmail.com

$ dmd --version
DMD64 D Compiler v2.068
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
$ cat app.d 
import core.internal.hash;

struct Foo {
    int[] arr;
    alias arr this;
}

void main() {
    Foo().hashOf();
}
$ dmd app.d 
app.d(9): Error: core.internal.hash.hashOf called with argument types (Foo)
matches both:
/usr/include/dlang/dmd/core/internal/hash.d(40):    
core.internal.hash.hashOf!(Foo).hashOf(Foo val, ulong seed)
and:
/usr/include/dlang/dmd/core/internal/hash.d(112):    
core.internal.hash.hashOf!(Foo).hashOf(Foo val, ulong seed)
/usr/include/dlang/dmd/object.d(2999): Error: core.internal.hash.hashOf called
with argument types (Foo, ulong) matches both:
/usr/include/dlang/dmd/core/internal/hash.d(40):    
core.internal.hash.hashOf!(Foo).hashOf(ref Foo val, ulong seed)
and:
/usr/include/dlang/dmd/core/internal/hash.d(112):    
core.internal.hash.hashOf!(Foo).hashOf(ref Foo val, ulong seed)
app.d(9): Error: template instance object.hashOf!(Foo) error instantiating

--
Sep 24 2015