Thread overview | |||||
---|---|---|---|---|---|
|
January 17, 2008 [Issue 1790] New: CTFE: foreach(Tuple) won't compile if Tuple contains string | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1790 Summary: CTFE: foreach(Tuple) won't compile if Tuple contains string Product: D Version: 1.025 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: clugdbug@yahoo.com.au Oddly, it compiles if you commment out the ; -- the foreach has to be non-empty. Behaviour is quite odd; if there are several items in the tuple, it will work if you don't use the whole tuple; eg Types[0..$-1] and Types[1..$] will work. So it sounds like some kind of memory corruption/unterminated string or similar. Possibly the root cause of some of the bugs in issue 1298. ======== bug.d(9): Error: cannot evaluate foo() at compile time --- int foo(Types...)() { foreach(T; Types) { ; // will compile if you remove this line } return 0; } const int q = foo!("")(); -- |
February 03, 2009 [Issue 1790] CTFE: foreach(Tuple) won't compile if Tuple contains string | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1790 ------- Comment #1 from clugdbug@yahoo.com.au 2009-02-03 08:18 ------- This workaround for this bug has changed. On 1.039, it now fails even if you comment out the marked line. But it compiles if you add [] to the string. int foo(Types...)() { foreach(T; Types) { ; } return 0; } const int q = foo!("abc"[])(); // OK -- |
January 31, 2010 [Issue 1790] CTFE: foreach(Tuple) won't compile if Tuple contains string | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1790 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2010-01-30 22:40:04 PST --- fixed dmd 1.056 and 2.040 -- 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