I think it should be informed as
" width(height) can not return lvalue. "
dmd(2.060) returned
" Internal error: ../ztc/cgcs.c 343 "
the example is follows:
class C{
private int[2] mysize;
// The wrong spelling of "mysize".
// but is not error but crash.
auto ref width(){ return this.size[0]; }
auto ref height(){ return this.size[1]; }
// getter and setter
@property{
int[2] size(){ return this.mysize; }
int[2] size( in int[2] xy ){
this.mysize = xy;
return xy;
}
}
}
Comment #1 by andrej.mitrovich — 2012-10-21T13:35:15Z
Interesting, only seems to happen when array is length 2 or less:
OK:
int[3] mysize;
@property auto size() { return mysize; }
int width() { return size[0]; }
void main() { }
FAIL:
int[2] mysize;
@property auto size() { return mysize; }
int width() { return size[0]; }
void main() { }
I've changed the title to make it more searchable for others. High priority since ICEs are important.
Comment #2 by andrej.mitrovich — 2013-01-02T17:15:30Z
New test-case, the error message seems to suggest it's related (line numbers are similar):
struct S
{
~this() { }
}
mixin template templ()
{
auto s = S();
}
void main()
{
mixin templ;
}
Comment #3 by andrej.mitrovich — 2013-01-02T17:15:52Z
(In reply to comment #2)
> New test-case, the error message seems to suggest it's related (line numbers
> are similar):
And error:
Internal error: ..\ztc\cgcs.c 344