digitalmars.D.bugs - [Issue 6611] New: array[]++ and array[]-- too?
- d-bugmail puremagic.com (32/32) Sep 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6611
- d-bugmail puremagic.com (12/12) Sep 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6611
- d-bugmail puremagic.com (14/18) Sep 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6611
- d-bugmail puremagic.com (9/20) Sep 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6611
- d-bugmail puremagic.com (10/10) Feb 14 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6611
- d-bugmail puremagic.com (13/13) Feb 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6611
- d-bugmail puremagic.com (10/10) Feb 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6611
http://d.puremagic.com/issues/show_bug.cgi?id=6611
Summary: array[]++ and array[]-- too?
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: bearophile_hugs eml.cc
This code contains two operations that are refused by DMD2.055beta:
void main() {
int[10] a;
a[] += 1; // OK
++a[]; // OK
--a[]; // OK
a[]++; // line 6, error
a[]--; // line 7, error
}
test2.d(6): Error: slice expression a[] is not a modifiable lvalue
test2.d(6): Error: 'a[]' is not a scalar, it is a int[]
test2.d(6): Error: cannot cast int to int[]
test2.d(7): Error: slice expression a[] is not a modifiable lvalue
test2.d(7): Error: 'a[]' is not a scalar, it is a int[]
test2.d(7): Error: cannot cast int to int[]
Maybe it's better to allow the last two lines too.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6611
yebblies <yebblies gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yebblies gmail.com
This line implies the following
a[]++ => (auto tmp = a[].dup, ++a[], tmp)
Do we really want it to be this easy to do?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6611This line implies the following a[]++ => (auto tmp = a[].dup, ++a[], tmp) Do we really want it to be this easy to do?I understand. If doing this is not good, then I suggest to turn this into a diagnostic enhancement request. So given code like this: void main() { int[10] a; a[]++; } to raise a single error message that explains why that vector op is on purpose not supported. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6611I understand. If doing this is not good, then I suggest to turn this into a diagnostic enhancement request. So given code like this:It's probably not worth introducing yet another hidden allocation, or a special case as it can be easily written using pre-inc.void main() { int[10] a; a[]++; } to raise a single error message that explains why that vector op is on purpose not supported.That sounds reasonable, the error message is terrible. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6611
yebblies <yebblies gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |pull
https://github.com/D-Programming-Language/dmd/pull/717
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6611 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/176b8752c6f9d92e2570bcb47b87419bf2f0ccd2 Issue 6611 - better error message for array post increment/decrement Detect attempts to use post increment/decrement on an array slice, and print a better error message. https://github.com/D-Programming-Language/dmd/commit/d082916311aca3d14e13295eaafa9b6e52cd81b3 Issue 6611 - better error message for array post increment/decrement -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6611
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |bugzilla digitalmars.com
Resolution| |FIXED
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2012









d-bugmail puremagic.com 