digitalmars.D.bugs - [Issue 980] New: If a function tries to concatenate a char to a empty array, dmd complains that the function can't be evaluated at compile time
- d-bugmail puremagic.com (31/31) Feb 18 2007 http://d.puremagic.com/issues/show_bug.cgi?id=980
- d-bugmail puremagic.com (9/9) Feb 26 2007 http://d.puremagic.com/issues/show_bug.cgi?id=980
- d-bugmail puremagic.com (8/8) Mar 08 2007 http://d.puremagic.com/issues/show_bug.cgi?id=980
http://d.puremagic.com/issues/show_bug.cgi?id=980
Summary: If a function tries to concatenate a char to a empty
array, dmd complains that the function can't be
evaluated at compile time
Product: D
Version: 1.006
Platform: PC
OS/Version: Linux
Status: NEW
Severity: minor
Priority: P3
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: teleledningsanka gmail.com
If a function tries to concatenate a char to a empty char[] array, dmd gives
the error "cannot evaluate ... at compile time". The same code works at
runtime. The workaround is to simply initialize the string.
Code that shows the bug:
/*
bug.d(12): Error: cannot evaluate (test)(0) at compile time
bug.d(13): Error: string expected for message, not '(test)(0)'
*/
char[] test(int dummy = 0) {
char[] s /*= ""*/ ; // Works if comment is removed
return s ~ 't';
}
void main() {
const x = test();
pragma(msg, x);
}
--
Feb 18 2007
http://d.puremagic.com/issues/show_bug.cgi?id=980
bugzilla digitalmars.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Fixed DMD 1.007
--
Feb 26 2007
http://d.puremagic.com/issues/show_bug.cgi?id=980 Added to DStress as http://dstress.kuehne.cn/compile/o/opCatAssign_22_A.d http://dstress.kuehne.cn/compile/o/opCatAssign_22_B.d http://dstress.kuehne.cn//compile/o/opCat_26_A.d http://dstress.kuehne.cn//compile/o/opCat_26_B.d --
Mar 08 2007









d-bugmail puremagic.com 