Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions std/conv.d
Original file line number Diff line number Diff line change
Expand Up @@ -2560,9 +2560,6 @@ Lerr:
string s1 = "123";
auto a1 = parse!(int, string, Yes.doCount)(s1);
assert(a1.data == 123 && a1.count == 3);

// parse only accepts lvalues
static assert(!__traits(compiles, parse!int("123")));
}

///
Expand Down
33 changes: 19 additions & 14 deletions std/format/internal/write.d
Original file line number Diff line number Diff line change
Expand Up @@ -1839,24 +1839,26 @@ template hasToString(T, Char)
else static if (is(typeof(
(T val) {
const FormatSpec!Char f;
static struct S {void put(scope Char s){}}
static struct S
{
@disable this(this);
void put(scope Char s){}
}
S s;
val.toString(s, f);
static assert(!__traits(compiles, val.toString(s, FormatSpec!Char())),
"force toString to take parameters by ref");
static assert(!__traits(compiles, val.toString(S(), f)),
"force toString to take parameters by ref");
})))
{
enum hasToString = HasToStringResult.customPutWriterFormatSpec;
}
else static if (is(typeof(
(T val) {
static struct S {void put(scope Char s){}}
static struct S
{
@disable this(this);
void put(scope Char s){}
}
S s;
val.toString(s);
static assert(!__traits(compiles, val.toString(S())),
"force toString to take parameters by ref");
})))
{
enum hasToString = HasToStringResult.customPutWriter;
Expand Down Expand Up @@ -1996,9 +1998,10 @@ template hasToString(T, Char)
static assert(hasToString!(G, char) == customPutWriter);
static assert(hasToString!(H, char) == customPutWriterFormatSpec);
static assert(hasToString!(I, char) == customPutWriterFormatSpec);
static assert(hasToString!(J, char) == hasSomeToString);
static assert(hasToString!(J, char) == hasSomeToString
|| hasToString!(J, char) == constCharSinkFormatSpec); // depends on -preview=rvaluerefparam
static assert(hasToString!(K, char) == constCharSinkFormatSpec);
static assert(hasToString!(L, char) == none);
static assert(hasToString!(L, char) == customPutWriterFormatSpec);
static if (hasPreviewIn)
{
static assert(hasToString!(M, char) == inCharSinkFormatSpec);
Expand Down Expand Up @@ -2105,9 +2108,10 @@ template hasToString(T, Char)
static assert(hasToString!(G, char) == customPutWriter);
static assert(hasToString!(H, char) == customPutWriterFormatSpec);
static assert(hasToString!(I, char) == customPutWriterFormatSpec);
static assert(hasToString!(J, char) == hasSomeToString);
static assert(hasToString!(J, char) == hasSomeToString
|| hasToString!(J, char) == constCharSinkFormatSpec); // depends on -preview=rvaluerefparam
static assert(hasToString!(K, char) == constCharSinkFormatSpec);
static assert(hasToString!(L, char) == none);
static assert(hasToString!(L, char) == HasToStringResult.customPutWriterFormatSpec);
static if (hasPreviewIn)
{
static assert(hasToString!(M, char) == inCharSinkFormatSpec);
Expand All @@ -2125,9 +2129,10 @@ template hasToString(T, Char)
static assert(hasToString!(inout(G), char) == customPutWriter);
static assert(hasToString!(inout(H), char) == customPutWriterFormatSpec);
static assert(hasToString!(inout(I), char) == customPutWriterFormatSpec);
static assert(hasToString!(inout(J), char) == hasSomeToString);
static assert(hasToString!(inout(J), char) == hasSomeToString
|| hasToString!(inout(J), char) == constCharSinkFormatSpec); // depends on -preview=rvaluerefparam
static assert(hasToString!(inout(K), char) == constCharSinkFormatSpec);
static assert(hasToString!(inout(L), char) == none);
static assert(hasToString!(inout(L), char) == customPutWriterFormatSpec);
static if (hasPreviewIn)
{
static assert(hasToString!(inout(M), char) == inCharSinkFormatSpec);
Expand Down