[Issue 24036] New: assert message in CTFE becomes `['m', 'e', 's', 's', 'a', 'g', 'e'][0..7]` if produced using std.format.format
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jul 7 05:02:21 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24036
Issue ID: 24036
Summary: assert message in CTFE becomes `['m', 'e', 's', 's',
'a', 'g', 'e'][0..7]` if produced using
std.format.format
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: zorael at gmail.com
Manjaro/Arch x86_64, dmd 2.104.0, ldc 1.33-beta2.
If I assert(0) in CTFE with a message string produced with std.format.format,
it is output to the terminal as an `['f', 'o', 'o'][0..3]` array, and not as a
string. If I make it a string literal it works as you'd expect. cast(string)
does not seem to help. .idup makes it "foo[0..3]".
https://run.dlang.io/is/94RE0Y
---
import std;
static immutable ctfeThing = ()
{
assert(0, format("%s", "message"));
return 42;
}();
void main() {}
---
--
More information about the Digitalmars-d-bugs
mailing list