Bug 7998 – static assert message string printing problem
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2012-04-27T05:09:00Z
Last change time
2012-11-17T19:34:15Z
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2012-04-27T05:09:10Z
This code:
import std.conv: to;
void main() {
//static assert(false, "some message");
static assert(false, to!string(1) ~ " some message");
}
Shows (dmd 2.060alpha):
test.d(4): Error: static assert ['1',' ','s','o','m','e',' ','m','e','s','s','a','g','e']
While uncommenting the first static assert gives a more correct printing of the error message:
test2.d(3): Error: static assert "some message"
This problem has shown up in code like:
import std.array: uninitializedArray;
void main() {
auto a = uninitializedArray!(int)(1);
}
Comment #1 by ellery-newcomer — 2012-07-31T17:43:31Z
*** Issue 8481 has been marked as a duplicate of this issue. ***
Comment #2 by github-bugzilla — 2012-11-17T19:32:57Z