D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3205 - CTFE: $ cannot be used in lvalues
Summary: CTFE: $ cannot be used in lvalues
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2009-07-23 23:55 UTC by Don
Modified: 2014-04-18 09:12 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 Don 2009-07-23 23:55:20 UTC
int bar()
{
   int [] x = [0, 1, 2];
   x[x.length-1] = 5; // works
   x[$-1] = 5; // fails
   return 0;
}

int z = bar();
---
ctfe.d(6): Error: variable __dollar is used before initialization
ctfe.d(10): Error: cannot evaluate bar() at compile time


I have a patch for this, together with 2569 and 1948.
Comment 1 Don 2009-07-24 02:20:31 UTC
Patch included in patch for bug#2569.
Comment 2 Walter Bright 2009-09-03 13:27:36 UTC
Fixed dmd 1.047 and 2.032