digitalmars.D.bugs - [Issue 5044] New: opIndexUnary not working for post++
- d-bugmail puremagic.com (48/48) Oct 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5044
- d-bugmail puremagic.com (10/10) Oct 17 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5044
- d-bugmail puremagic.com (10/10) Jul 26 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5044
http://d.puremagic.com/issues/show_bug.cgi?id=5044 Summary: opIndexUnary not working for post++ Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: ah08010-d yahoo.com PDT --- This code: ========== module scratch; class C( element_t ) { element_t [] contents; element_t opIndex( int index ) { return contents[ index ]; } element_t opIndexUnary( string op )( int index ) { static if( op == "++" ) { return ++contents[ index ]; } else { static assert( false ); } } } unittest { auto c = new C!int(); c[0]++; } ========== Produces this output: ========== $ dmd -c -unittest scratch.d scratch.d(42): Error: c.opIndex(0) is not an lvalue ========== But if the penultimate line: "c[0]++" is replaced by "++c[0]", there is no problem. And finally, if the opIndex is changed to return a 'ref', there is not problem, but the opIndexUnary operator is not called - the reference is incremented as an int, I think. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 11 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5044 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid CC| |clugdbug yahoo.com.au Severity|normal |major -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 17 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5044 monarchdodra gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hsteoh quickfur.ath.cx *** Issue 7733 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 26 2012