Mercurial > projects > dstress
view nocompile/bug_mtype_3154.d @ 1528:36d8e64392df
[Issue 1187] Segfault with syntax error in two-level mixin.
Don Clugston <clugdbug@yahoo.com.au>
2007-04-24
http://d.puremagic.com/issues/show_bug.cgi?id=1187
author | thomask |
---|---|
date | Fri, 27 Apr 2007 17:31:50 +0000 |
parents | 774e02c900da |
children |
line wrap: on
line source
// $HeadURL$ // $Date$ // $Author$ // @author@ Daniel Horn <hellcatv@hotmail.com> // @date@ 2004-04-30 // @uri@ news:c6ullo$104s$1@digitaldaemon.com // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=48 // __DSTRESS_ELINE__ 51 module dstress.nocompile.bug_mtype_3154; struct vec(VALUE, int size){ enum {nvalues=1} VALUE [size]f; VALUE* getAt(uint i) { return i<size?&f[i]:&f[size-1]; } VALUE opIndexAssign(uint i, VALUE v) { return (*getAt(i))=v; } VALUE opIndexAssign(uint i) { return i<size?f[i]:f[size-1]; } template T(zvec) { zvec castTo() { zvec ret; for (int i=max(ret.nvalues-1,size-1);i>=0;i--) { ret[i]=this[i]; } return ret; } } } alias vec!(float,1) float1; alias vec!(float,4) float4; int main (char[][]args) { float1 a; float4 b; b[0]=1,b[1]=2,b[2]=3,b[3]=4; a[1]=3; b=a.T(float4).castTo();// <-- taking out this line stops the error return 0; }