This is an interesting one that has cropped up. I'm curious if
this is because the differences between a fixed/dynamic arrays.
Working around it is easy enough but that it even does it is an
annoyance.

I'm not seeing this exact problem in the archives, and I am not
sure if it's in the tracker already under a different
name/identifier. :(


---
module internal_error_485;
/*Internal error: ..\ztc\cod3.c 485
happens when class (or inherited) have one return a string (to
convert) and the other with the workaround.

Oddly it isn't doing auto conversion/shortening on a string of
a known size.
*/

alias immutable(char[4]) string4;
class x {
     string4 f() {
//      return cast(string4) "HEDR";    //Internal error:
..\ztc\cod3.c 485
//      return cast(string4) "HEDR".ptr;  //same

//      return "HEDR";      //implicit conversion fails
//      return string4("HEDR");  //temporary object doesn't
create properly for returning.

         string4 x = "HEDR";
         return x;
     }
}

class z : x {
     override string4 f() {
       return "brk_";  //Internal error: ..\ztc\cod3.c 485
//    return cast(string4) "brk_";  //Same error

//    following works... but...
//    string4 x = "brk_";
//    return x;
     }
}

---

    it also breaks the same way if the base class returns the
string
and the inherited class returns the converted/long steps.

Reply via email to