Thread overview | |||||
---|---|---|---|---|---|
|
October 12, 2010 [Issue 5044] New: opIndexUnary not working for post++ | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from Austin Hastings <ah08010-d@yahoo.com> 2010-10-11 17:44:11 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: ------- |
October 17, 2010 [Issue 5044] opIndexUnary not working for post++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Austin Hastings | 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: ------- |
July 26, 2012 [Issue 5044] opIndexUnary not working for post++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Austin Hastings | http://d.puremagic.com/issues/show_bug.cgi?id=5044 monarchdodra@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hsteoh@quickfur.ath.cx --- Comment #1 from monarchdodra@gmail.com 2012-07-26 01:28:56 PDT --- *** 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: ------- |
Copyright © 1999-2021 by the D Language Foundation