testFilename in std.stdio

2021-07-23 Thread Rogni via Digitalmars-d-learn

Hi everyone.
I have a file main.d

```
import std.stdio: writeln;
int main (string []) { return 0; }
```

When I try to get depend files with command `ldc2 main.d 
--unittest --deps=main.deps --o-` such errors are received:


```
/home/mak/progs/ldc2-1.26.0-linux-x86_64/bin/../import/std/stdio.d(563): Error: 
undefined identifier `testFilename`
/home/mak/progs/ldc2-1.26.0-linux-x86_64/bin/../import/std/stdio.d(759): Error: 
undefined identifier `testFilename`
/home/mak/progs/ldc2-1.26.0-linux-x86_64/bin/../import/std/stdio.d(765): Error: 
undefined identifier `testFilename`
/home/mak/progs/ldc2-1.26.0-linux-x86_64/bin/../import/std/stdio.d(781): Error: 
undefined identifier `testFilename`
...
```

Is it possible that the std/stdio.d function 
[`testFilename`](https://github.com/dlang/phobos/blob/adff6577b9fd5f512ec348494e8037a0bb71b89f/std/stdio.d#L5908) wrapped in `version (StdUnittest)` is in version (unittest) ?


version of ldc - 1.26.0


called copy constructor in foreach with ref on Range

2020-06-21 Thread Rogni via Digitalmars-d-learn

https://pastebin.com/BYcRN8T2

why called copy constructor for ref Range struct type in foreach ?

```
struct MyRange {
private int current_row = 0;
private int rows_count = 5;
@disable this(this); // <===
bool empty () { return current_row == rows_count; }
int front() { return current_row*current_row; }
void popFront() { ++current_row; }
}

struct Container {
@disable this(this); // <===
int opApply(int delegate(int) dg) {
foreach (int row; 0..5) dg(row*row);
return 1;
}
}

void foreach_iterable(Type)(ref Type iterable) {
import std.stdio: writeln;
foreach (int row_value; iterable) { // test_range.d(20): 
Error: struct test_range.MyRange is not copyable because it is 
annotated with @disable

row_value.writeln;
}
}

void call_iterable(Type)() {
Type iterable;
foreach_iterable(iterable);
}

void main() {
call_iterable!Container(); // work
call_iterable!MyRange(); // does`t work
}
```

ldc2 version: version   1.8.0 (DMD v2.078.3, LLVM 5.0.1)