Skip to content

Commit 9d4a259

Browse files
committed
add scope qualifier for structs
1 parent b9706da commit 9d4a259

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ mir-algorithm-test-secure
4141
bigint_benchmark/bigint_benchmark
4242
bigint_benchmark/temp.d
4343
mir-algorithm-test-silly
44+
mir-algorithm-test-ci-bignum-test

source/mir/format.d

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ unittest
902902

903903
/// Prints structs and unions
904904
pragma(inline, false)
905-
ref W print(C = char, W, T)(scope return ref W w, ref const T c)
905+
ref W print(C = char, W, T)(scope return ref W w, ref scope const T c)
906906
if (isSomeChar!C && is(T == struct) || is(T == union) && !is(T : NumericSpec))
907907
{
908908
static if (__traits(hasMember, T, "toString"))
@@ -945,7 +945,8 @@ ref W print(C = char, W, T)(scope return ref W w, ref const T c)
945945
static if (is(typeof(w.put((*cast(T*)&c).toString))))
946946
w.put((*cast(T*)&c).toString);
947947
else
948-
static assert(0, T.stringof ~ ".toString definition is wrong: 'const' qualifier may be missing.");
948+
c.toString(w);
949+
// static assert(0, T.stringof ~ ".toString definition is wrong: 'const' qualifier may be missing.");
949950
}
950951

951952
return w;
@@ -994,7 +995,7 @@ ref W print(C = char, W, T)(scope return ref W w, ref const T c)
994995
/// ditto
995996
// FUTURE: remove it
996997
pragma(inline, false)
997-
ref W print(C = char, W, T)(scope return ref W w, const T c)
998+
ref W print(C = char, W, T)(scope return ref W w, scope const T c)
998999
if (isSomeChar!C && is(T == struct) || is(T == union))
9991000
{
10001001
return print!(C, W, T)(w, c);

0 commit comments

Comments
 (0)