This repository was archived by the owner on Oct 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -58,10 +58,20 @@ auto miniFormat(V)(V v)
58
58
const len = sprintf(&val[0 ], " %g" , v);
59
59
return val.idup[0 .. len];
60
60
}
61
+ // special-handling for void-arrays
62
+ else static if (is (V == typeof (null )))
63
+ {
64
+ return " `null`" ;
65
+ }
61
66
else static if (__traits(compiles, { string s = V.init.toString(); }))
62
67
{
63
68
return v.toString();
64
69
}
70
+ // special-handling for void-arrays
71
+ else static if (is (V == void []))
72
+ {
73
+ return " " ;
74
+ }
65
75
// anything string-like
66
76
else static if (__traits(compiles, V.init ~ " " ))
67
77
{
Original file line number Diff line number Diff line change @@ -119,6 +119,17 @@ void testAttributes() @safe pure @nogc nothrow
119
119
assert (a == 0 );
120
120
}
121
121
122
+ // https://issues.dlang.org/show_bug.cgi?id=20066
123
+ void testVoidArray ()()
124
+ {
125
+ assert ([] is null );
126
+ assert (null is null );
127
+ test([1 ], null , " [1] != []" );
128
+ test(" s" , null , ` "s" != ""` );
129
+ test([' c' ], null , ` "c" != ""` );
130
+ test! " !=" (null , null , " `null` == `null`" );
131
+ }
132
+
122
133
void main ()
123
134
{
124
135
testIntegers();
@@ -130,5 +141,6 @@ void main()
130
141
testStruct();
131
142
testAA();
132
143
testAttributes();
144
+ testVoidArray();
133
145
fprintf(stderr, " success.\n " );
134
146
}
You can’t perform that action at this time.
0 commit comments