Bug 7820 – regression(DMD 2.059head) Wrong error on forward reference to 'front' with -property switch

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-04T10:56:00Z
Last change time
2015-06-09T05:15:22Z
Keywords
rejects-valid
Assigned to
nobody
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2012-04-04T10:56:44Z
The following code does not compile with DMD 2.059head, when passed the -property switch. int[] array; pragma(msg, typeof(array.front)); @property ref T front(T)(T[] a){return a[0];} Moving the declaration of front to the top fixes the error. This was reduced from a template matching failure (std.algorithm.canFind cannot be instantiated with built-in array types). The same code compiles fine with DMD 2.058. Another manifestation of what looks like the same issue: pragma(msg, typeof(x)); // prints 'int' instead of 'const(int)' const int x;
Comment #1 by bugzilla — 2012-04-05T23:27:20Z
The second issue is not the same and isn't a regression.
Comment #2 by github-bugzilla — 2012-04-05T23:28:16Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6fc972df155d69de9b001b28dc6f5a7d16faf351 fix Issue 7820 - regression(DMD 2.059head) Wrong error on forward reference to 'front' with -property switch
Comment #3 by timon.gehr — 2012-04-06T02:26:40Z
(In reply to comment #1) > The second issue is not the same and isn't a regression. OK. Reposted as issue 7846.
Comment #4 by timon.gehr — 2012-04-06T02:40:25Z
The code this was reduced from still does not compile with -property for the same reason. I will try to create another reduced example and then reopen the issue.
Comment #5 by timon.gehr — 2012-04-06T04:33:19Z
These snippets still expose the buggy behavior even after the fix: --- int[] array; pragma(msg, typeof(array.front)); @property int front(int[] a){return a[0];} --- --- import std.algorithm; alias find!("a == b",int[],int) test; --- I assume it is the same bug in both cases.
Comment #6 by github-bugzilla — 2012-04-06T14:54:52Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/37c1856876382d820372dec621c46e884e5c97ab fix Issue 7820 - regression(DMD 2.059head) Wrong error on forward reference to 'front' with -property switch