[Issue 5852] New: CTFE: wrong code for string[] ~= const(string)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 18 03:19:13 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5852
Summary: CTFE: wrong code for string[] ~= const(string)
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: clugdbug at yahoo.com.au
--- Comment #0 from Don <clugdbug at yahoo.com.au> 2011-04-18 03:15:36 PDT ---
int bug5852(const(string) s)
{
string [] r;
r ~= s;
assert(r.length == 1);
return r[0].length;
}
static assert(bug5852("abc")==3);
The (non-static) assert fails, and if it's commented out, you get:
test2.d(11): Error: integral constant must be scalar type, not string
test2.d(11): Error: cannot evaluate bug5852("abc") at compile time
test2.d(11): Error: static assert (bug5852("abc") == 3) is not evaluatable at
c
ompile time
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list