diff --git a/compiler/src/dmd/expressionsem.d b/compiler/src/dmd/expressionsem.d index 6e2aeb46eda..d457dd18bec 100644 --- a/compiler/src/dmd/expressionsem.d +++ b/compiler/src/dmd/expressionsem.d @@ -3288,6 +3288,7 @@ private bool functionParameters(const ref Loc loc, Scope* sc, else if (p.storageClass & STC.ref_) { if (global.params.rvalueRefParam == FeatureState.enabled && + !p.storageClass & STC.return_ && !arg.isLvalue() && targ.isCopyable()) { /* allow rvalues to be passed to ref parameters by copying diff --git a/compiler/test/compilable/reverthelp.d b/compiler/test/compilable/reverthelp.d index febbba1445a..c8dab44e1bb 100644 --- a/compiler/test/compilable/reverthelp.d +++ b/compiler/test/compilable/reverthelp.d @@ -9,5 +9,6 @@ Revertable language changes listed by -revert=name: =dip1000 revert DIP1000 changes (Scoped Pointers) (https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1000.md) =intpromote revert integral promotions for unary + - ~ operators =dtorfields don't destruct fields of partially constructed objects + =rvaluerefparam revert rvalue arguments to ref parameters ---- */ diff --git a/compiler/test/fail_compilation/fail9773.d b/compiler/test/fail_compilation/fail9773.d deleted file mode 100644 index 26447a73914..00000000000 --- a/compiler/test/fail_compilation/fail9773.d +++ /dev/null @@ -1,10 +0,0 @@ -/* -TEST_OUTPUT: ---- -fail_compilation/fail9773.d(7): Error: cannot create default argument for `ref` / `out` parameter from expression `""` because it is not an lvalue ---- -*/ -void f(ref string a = "") -{ - a = "crash and burn"; -}