[Issue 2154] New: static if (is(typeof(E.toString()) : string)) in template broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 18 14:51:59 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2154

           Summary: static if (is(typeof(E.toString()) : string))  in
                    template broken
           Product: D
           Version: 2.014
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: someanon at yahoo.com


This code works fine with v2.013.

Both v2.014, v2.015 now errors out.

BTW, is there another way to write this code? thanks.

$ cat temp.d

class V(E) {
    E[2] data;
    public /*override*/ string toString() {
      static if (is(typeof(E.toString()) : string)) {  // error line!
      return "";
      } else {
      string str = "";
      return str;
      }
    }
}

class A {
  public string toString() {
    return "";
  }
}

typedef V!(A) VA;


$ dmd -c temp.d
Error: this for toString needs to be type A not type temp.V!(A).V


-- 



More information about the Digitalmars-d-bugs mailing list