974 – compile-time parenthesis bug

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 974 - compile-time parenthesis bug
Summary: compile-time parenthesis bug
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL:
Keywords:
Depends on:
Blocks:
Reported: 2007年02月17日 05:14 UTC by Daniel
Modified: 2014年02月16日 15:25 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Daniel 2007年02月17日 05:14:44 UTC
import std.stdio;
template eval(A...) { alias A eval; }
char[] trimfirst(char[] s)
{
 int x = 0;
 foreach (char each; s) {
 if (each != ' ')
 //{
 return s[x .. $];
 //}
 //Without the parenthesis, the compile-time version doesn't work !
 x++;
 }
 return s;
}
void main()
{
 writefln(eval!(trimfirst(" test"))); //Output: " test"
 writefln(trimfirst(" test")); //Output: "test"
}
Comment 1 Walter Bright 2007年02月26日 19:26:12 UTC
Fixed DMD 1.007
Comment 2 Thomas Kühne 2007年03月11日 06:20:44 UTC
Added to DStress as
http://dstress.kuehne.cn/run/i/interpret_01_A.d
http://dstress.kuehne.cn/run/i/interpret_01_B.d 


AltStyle によって変換されたページ (->オリジナル) /