D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7820 - regression(DMD 2.059head) Wrong error on forward reference to 'front' with -property switch
Summary: regression(DMD 2.059head) Wrong error on forward reference to 'front' with -p...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2012-04-04 10:56 UTC by timon.gehr
Modified: 2015-06-09 05:15 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description timon.gehr 2012-04-04 10:56:44 UTC
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 Walter Bright 2012-04-05 23:27:20 UTC
The second issue is not the same and isn't a regression.
Comment 2 github-bugzilla 2012-04-05 23:28:16 UTC
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 timon.gehr 2012-04-06 02:26:40 UTC
(In reply to comment #1)
> The second issue is not the same and isn't a regression.

OK. Reposted as issue 7846.
Comment 4 timon.gehr 2012-04-06 02:40:25 UTC
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 timon.gehr 2012-04-06 04:33:19 UTC
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 github-bugzilla 2012-04-06 14:54:52 UTC
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