[Issue 19779] New: `assert`ions evaluate in CTFE do not print `char[]` arrays as strings
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 31 05:44:44 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19779
Issue ID: 19779
Summary: `assert`ions evaluate in CTFE do not print `char[]`
arrays as strings
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: slavo5150 at yahoo.com
Example:
int test(int x)
{
const char[3] msg = ['a', 'b', 'c'];
assert(false, msg);
return x;
}
void main()
{
// This statement incorrectly displays
// Error: ['a', 'b', 'c'][0..3]
enum x = test(1);
// At runtime, however, it correctly displays
// core.exception.AssertError at ladder.d(5): abc
auto y = test(1);
}
I expect `enum x test(1)` to display "abc" instead of "['a', 'b', 'c'][0..3]"
--
More information about the Digitalmars-d-bugs
mailing list