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
21 changes: 19 additions & 2 deletions std/conv.d
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,23 @@ template to(T)
assert(text(null) == "null");
}

// Test `scope` inference of parameters of `text`
@safe unittest
{
static struct S
{
int* x; // make S a type with pointers
string toString() const scope
{
static int g = 0; // force toString to be impure for:
g++; // https://issues.dlang.org/show_bug.cgi?id=20150
return "S";
}
}
scope S s;
assert(text("a", s) == "aS");
}

// Tests for issue 11390
@safe pure /+nothrow+/ unittest
{
Expand Down Expand Up @@ -4778,8 +4795,8 @@ private S textImpl(S, U...)(U args)
// assume that on average, parameters will have less
// than 20 elements
app.reserve(U.length * 20);

foreach (arg; args)
// Must be static foreach because of https://issues.dlang.org/show_bug.cgi?id=21209
static foreach (arg; args)
{
static if (
isSomeChar!(typeof(arg)) || isSomeString!(typeof(arg)) ||
Expand Down
3 changes: 2 additions & 1 deletion std/range/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,8 @@ if (Ranges.length > 0 &&
public:
this(R input)
{
foreach (i, v; input)
// Must be static foreach because of https://issues.dlang.org/show_bug.cgi?id=21209
static foreach (i, v; input)
{
source[i] = v;
}
Expand Down