Fix Issue 9489 - writeln of struct with disabled copy ctor#8055
Fix Issue 9489 - writeln of struct with disabled copy ctor#8055dlang-bot merged 1 commit intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @berni44! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + phobos#8055" |
The testers complain about this too. Any ideas how to handle this more flexible? As far as I know, something like |
|
Seems to work now. I replaced the Anyway, please carefully check this, I don't know if this might have unwanted side effects. |
|
This seems like the correct fix. What happens if you use the normal What part of this issue remains unfixed? |
I'm unsure, what you mean with that.
Sure. Soon.
First of all it has to be With that I'll get an static assert error "Scoped[] must be an InputRange" - this seems to be something else. |
| import std.utf : UTFException; | ||
| auto w = lockingTextWriter(); | ||
| foreach (arg; args) | ||
| static foreach (i; 0 .. args.length) |
There was a problem hiding this comment.
I'm unsure, what you mean with that.
What happens if you don't use static ?
There was a problem hiding this comment.
"std/stdio.d(1689): Error: variable i cannot be read at compile time"
Yeah, that's unrelated. You might want to update the commit message so that the bot auto-closes the issue. |
|
This introduced a regression: https://issues.dlang.org/show_bug.cgi?id=21920 |
To be honest, I do not understand that error message ("Error: and thus |
|
|
Sorry, I still don't understand (maybe because I'm not familiar with IFTI - I do not even know what that is). I expect |
|
No. When instantiating the template, the compiler must decide whether to instantiate the void main()
{
int v;
void nonref(T)(T t) {}
nonref(1); // OK
nonref(v); // OK, by value (a copy occurs)
alias nonref_int = nonref!int; // OK, void(int)
void byref(T)(ref T t) {}
byref(1); // error, requires ref
byref(v); // OK, by ref
alias byref_int = byref!int; // OK, void(ref int)
void autoref(T)(auto ref T t) {}
autoref(1); // OK, auto ref resolved as non-ref
autoref(v); // OK, auto ref resolved as ref (no copy)
alias autoref_int = autoref!int; // error, don't know what to do
} |
Ah, thanks, now I do understand (and I still think, the message could be improved). Anyway, I fear, there is no possibility to tell the compiler to use the non-ref version as a default? |
|
Not that I know of (but I don't know many things). I suggest reverting the change to fix the regression and add a test until a better solution is found. |
Go on. As I wrote at the beginning of the PR: I feared something like that, but could not see it. |
This fixes the first of the two errors described in issue 9489. However, I'm not sure, if I don't break something else. This is especially true for the
refin theforeach-loop, especially, because when I try to fix the second part too, I get a "Error: symbol_param_0cannot beref" pointing to thisforeach.Additionally, this produces a lot of merge conflicts with #8031.
So I'm quite unsure, if this should be merged. What do you think?