digitalmars.D.bugs - [Issue 1790] New: CTFE: foreach(Tuple) won't compile if Tuple contains string
- d-bugmail puremagic.com (31/31) Jan 17 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1790
- d-bugmail puremagic.com (12/12) Feb 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=1790
- d-bugmail puremagic.com (12/12) Jan 30 2010 http://d.puremagic.com/issues/show_bug.cgi?id=1790
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!("")();
--
Jan 17 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1790
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
--
Feb 03 2009
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
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: -------
Jan 30 2010









d-bugmail puremagic.com 