[Issue 14757] New: Wrong error message: Error: multi-dimensional slicing requires template opSlice

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jul 1 11:32:01 PDT 2015


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

          Issue ID: 14757
           Summary: Wrong error message: Error: multi-dimensional slicing
                    requires template opSlice
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: timothee.cour2 at gmail.com

----
struct A{
  auto opSlice(uint dim)(int a, int b){
    foobar();
    return 0;
  }

  auto opIndex(T...)(T args){
    return 2;
  }
}

void main(){
  A a;
  a[0..1, 0];//Error: multi-dimensional slicing requires template opSlice
  //a[0..1];//slightly less cryptic error message for this
}
----

--


More information about the Digitalmars-d-bugs mailing list