Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 13, 2012 [Issue 8649] New: Not accepted "const ref Type" in foreach | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=8649 Summary: Not accepted "const ref Type" in foreach Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: minor Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2012-09-13 04:12:08 PDT --- void foo(ref const int x) {} // OK void bar(const ref int x) {} // OK void main() { foreach (ref const int x; [1, 2, 3]) {} // OK foreach (const ref int x; [1, 2, 3]) {} // error } DMD 2.061alpha gives: test.d(5): Error: basic type expected, not ref test.d(5): Error: no identifier for declarator const(int) test.d(5): Error: found 'ref' when expecting ';' test.d(5): Error: found 'x' when expecting '.' following int test.d(5): Error: found ';' when expecting identifier following 'int.' -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 13, 2012 [Issue 8649] Not accepted "const ref Type" in foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8649 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-09-13 04:29:38 PDT --- This is a dup of issue 4090. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 13, 2012 [Issue 8649] Not accepted "const ref Type" in foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8649 --- Comment #2 from bearophile_hugs@eml.cc 2012-09-13 04:55:51 PDT --- (In reply to comment #1) > This is a dup of issue 4090. At first sight it doesn't look like the same issue, because here I am listing all the types and modifiers. "const ref int" is refused, while "ref const int" is accepted. In both cases no type inferencing is required. While in issue 4090 I put "const ref" so some type inferencing was required. In the end if you think it's the same issue feel free to close this issue as a duplicated. Thank you. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 16, 2012 [Issue 8649] Not accepted "const ref Type" in foreach | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8649 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2012-09-16 04:53:49 PDT --- (In reply to comment #2) > (In reply to comment #1) > > This is a dup of issue 4090. > > At first sight it doesn't look like the same issue, because here I am listing all the types and modifiers. "const ref int" is refused, while "ref const int" is accepted. In both cases no type inferencing is required. > > While in issue 4090 I put "const ref" so some type inferencing was required. > > In the end if you think it's the same issue feel free to close this issue as a duplicated. Thank you. As I explained in the issue, it's current grammar limitation, and it doesn't matter whether a type inference is required. So I'll change this to 'resolved duplicated'. *** This issue has been marked as a duplicate of issue 4090 *** -- 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