[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 at puremagic.com
d-bugmail at puremagic.com
Sun Feb 18 15:55:07 PST 2007
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 at digitalmars.com
ReportedBy: teleledningsanka at 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);
}
--
More information about the Digitalmars-d-bugs
mailing list