diff --git a/compiler/test/compilable/fix21647.d b/compiler/test/compilable/fix21647.d index 58f144045d32..f26fd9523c6d 100644 --- a/compiler/test/compilable/fix21647.d +++ b/compiler/test/compilable/fix21647.d @@ -1,5 +1,5 @@ /* -REQUIRED_ARGS: -preview=rvaluerefparam +REQUIRED_ARGS: TEST_OUTPUT: --- cast(void)0 diff --git a/compiler/test/compilable/issue20704.d b/compiler/test/compilable/issue20704.d index ec95828007fc..529dcfc3641b 100644 --- a/compiler/test/compilable/issue20704.d +++ b/compiler/test/compilable/issue20704.d @@ -1,6 +1,6 @@ /* https://issues.dlang.org/show_bug.cgi?id=20704 -REQUIRED_ARGS: -preview=rvaluerefparam +REQUIRED_ARGS: */ void f1(T)(const auto ref T arg = T.init) {} diff --git a/compiler/test/compilable/issue20705.d b/compiler/test/compilable/issue20705.d index 76a364e129b9..c8fef59fa08d 100644 --- a/compiler/test/compilable/issue20705.d +++ b/compiler/test/compilable/issue20705.d @@ -1,4 +1,4 @@ -// REQUIRED_ARGS: -preview=rvaluerefparam +// REQUIRED_ARGS: struct Foo { int[] a; diff --git a/compiler/test/compilable/previewhelp.d b/compiler/test/compilable/previewhelp.d index 14d5781964e1..3291708549a6 100644 --- a/compiler/test/compilable/previewhelp.d +++ b/compiler/test/compilable/previewhelp.d @@ -12,7 +12,6 @@ Upcoming language changes listed by -preview=name: =bitfields add C-like bitfields (https://github.com/dlang/dlang.org/pull/3190) =fieldwise use fieldwise comparisons for struct equality (https://dlang.org/changelog/2.085.0.html#no-cmpsb) =fixAliasThis when a symbol is resolved, check alias this scope before going to upper scopes (https://github.com/dlang/dmd/pull/8885) - =rvaluerefparam enable rvalue arguments to ref parameters (https://gist.github.com/andralex/e5405a5d773f07f73196c05f8339435a) =nosharedaccess disable access to shared memory objects (https://dlang.org/spec/const3.html#shared) =in `in` on parameters means `scope const [ref]` and accepts rvalues (https://dlang.org/spec/function.html#in-params) =inclusiveincontracts 'in' contracts of overridden methods must be a superset of parent contract (https://dlang.org/changelog/2.095.0.html#inclusive-incontracts) diff --git a/compiler/test/compilable/reverthelp.d b/compiler/test/compilable/reverthelp.d index febbba1445a4..150c8697d338 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 (https://gist.github.com/andralex/e5405a5d773f07f73196c05f8339435a) ---- */ diff --git a/compiler/test/compilable/rvalueref.d b/compiler/test/compilable/rvalueref.d index 1c96c36f1f5b..9ad60e27dd8e 100644 --- a/compiler/test/compilable/rvalueref.d +++ b/compiler/test/compilable/rvalueref.d @@ -1,4 +1,4 @@ -/* REQUIRED_ARGS: -preview=rvaluerefparam +/* REQUIRED_ARGS: */ struct AS diff --git a/compiler/test/fail_compilation/b20011.d b/compiler/test/fail_compilation/b20011.d index 50ef6aff6097..340a7f9abedf 100644 --- a/compiler/test/fail_compilation/b20011.d +++ b/compiler/test/fail_compilation/b20011.d @@ -1,19 +1,13 @@ /* TEST_OUTPUT: --- -fail_compilation/b20011.d(28): Error: cannot modify expression `S1(cast(ubyte)0u).member` because it is not an lvalue -fail_compilation/b20011.d(31): Error: cannot modify expression `S2(null).member` because it is not an lvalue -fail_compilation/b20011.d(32): Error: cannot modify expression `S2(null).member` because it is not an lvalue -fail_compilation/b20011.d(35): Error: cannot modify expression `U1(cast(ubyte)0u, ).m2` because it is not an lvalue -fail_compilation/b20011.d(40): Error: function `assignableByRef` is not callable using argument types `(ubyte)` -fail_compilation/b20011.d(40): cannot pass rvalue argument `S1(cast(ubyte)0u).member` of type `ubyte` to parameter `ref ubyte p` -fail_compilation/b20011.d(37): `b20011.main.assignableByRef(ref ubyte p)` declared here -fail_compilation/b20011.d(41): Error: function `assignableByOut` is not callable using argument types `(ubyte)` -fail_compilation/b20011.d(41): cannot pass rvalue argument `S1(cast(ubyte)0u).member` of type `ubyte` to parameter `out ubyte p` -fail_compilation/b20011.d(38): `b20011.main.assignableByOut(out ubyte p)` declared here -fail_compilation/b20011.d(42): Error: function `assignableByConstRef` is not callable using argument types `(ubyte)` -fail_compilation/b20011.d(42): cannot pass rvalue argument `S1(cast(ubyte)0u).member` of type `ubyte` to parameter `ref const(ubyte) p` -fail_compilation/b20011.d(39): `b20011.main.assignableByConstRef(ref const(ubyte) p)` declared here +fail_compilation/b20011.d(22): Error: cannot modify expression `S1(cast(ubyte)0u).member` because it is not an lvalue +fail_compilation/b20011.d(25): Error: cannot modify expression `S2(null).member` because it is not an lvalue +fail_compilation/b20011.d(26): Error: cannot modify expression `S2(null).member` because it is not an lvalue +fail_compilation/b20011.d(29): Error: cannot modify expression `U1(cast(ubyte)0u, ).m2` because it is not an lvalue +fail_compilation/b20011.d(35): Error: function `assignableByOut` is not callable using argument types `(ubyte)` +fail_compilation/b20011.d(35): cannot pass rvalue argument `S1(cast(ubyte)0u).member` of type `ubyte` to parameter `out ubyte p` +fail_compilation/b20011.d(32): `b20011.main.assignableByOut(out ubyte p)` declared here --- */ module b20011; diff --git a/compiler/test/fail_compilation/fail20183.d b/compiler/test/fail_compilation/fail20183.d index 9d99212adac7..6770bdd44997 100644 --- a/compiler/test/fail_compilation/fail20183.d +++ b/compiler/test/fail_compilation/fail20183.d @@ -1,9 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fail20183.d(1016): Error: function `addr` is not callable using argument types `(int)` -fail_compilation/fail20183.d(1016): cannot pass rvalue argument `S(0).i` of type `int` to parameter `return ref int b` -fail_compilation/fail20183.d(1004): `fail20183.addr(return ref int b)` declared here +fail_compilation/fail20183.d(1016): Error: address of variable `__rvalue2` assigned to `p` with longer lifetime fail_compilation/fail20183.d(1017): Error: address of expression temporary returned by `s()` assigned to `q` with longer lifetime fail_compilation/fail20183.d(1018): Error: address of struct literal `S(0)` assigned to `r` with longer lifetime --- diff --git a/compiler/test/fail_compilation/fail7603a.d b/compiler/test/fail_compilation/fail7603a.d deleted file mode 100644 index a106a566a5c4..000000000000 --- a/compiler/test/fail_compilation/fail7603a.d +++ /dev/null @@ -1,7 +0,0 @@ -/* -TEST_OUTPUT: ---- -fail_compilation/fail7603a.d(7): Error: cannot create default argument for `ref` / `out` parameter from constant `true` ---- -*/ -void test(ref bool val = true) { } diff --git a/compiler/test/fail_compilation/fail7603b.d b/compiler/test/fail_compilation/fail7603b.d index a6524221afd8..e3d1a7f398f3 100644 --- a/compiler/test/fail_compilation/fail7603b.d +++ b/compiler/test/fail_compilation/fail7603b.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail7603b.d(7): Error: cannot create default argument for `ref` / `out` parameter from constant `true` +fail_compilation/fail7603b.d(7): Error: cannot create default argument for `out` parameter from constant `true` --- */ void test(out bool val = true) { } diff --git a/compiler/test/fail_compilation/fail7603c.d b/compiler/test/fail_compilation/fail7603c.d deleted file mode 100644 index 3d030fc9668c..000000000000 --- a/compiler/test/fail_compilation/fail7603c.d +++ /dev/null @@ -1,8 +0,0 @@ -/* -TEST_OUTPUT: ---- -fail_compilation/fail7603c.d(8): Error: cannot create default argument for `ref` / `out` parameter from constant `3` ---- -*/ -enum x = 3; -void test(ref int val = x) { } diff --git a/compiler/test/fail_compilation/fail9773.d b/compiler/test/fail_compilation/fail9773.d deleted file mode 100644 index 26447a73914e..000000000000 --- 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"; -} diff --git a/compiler/test/fail_compilation/fail9891.d b/compiler/test/fail_compilation/fail9891.d index 0c2384fccfa4..b3a1e1625646 100644 --- a/compiler/test/fail_compilation/fail9891.d +++ b/compiler/test/fail_compilation/fail9891.d @@ -1,9 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail9891.d(13): Error: expression `i` of type `immutable(int)` is not implicitly convertible to type `ref int` of parameter `n` -fail_compilation/fail9891.d(18): Error: expression `i` of type `immutable(int)` is not implicitly convertible to type `out int` of parameter `n` -fail_compilation/fail9891.d(23): Error: cannot create default argument for `ref` / `out` parameter from expression `prop()` because it is not an lvalue +fail_compilation/fail9891.d(12): Error: expression `i` of type `immutable(int)` is not implicitly convertible to type `ref int` of parameter `n` +fail_compilation/fail9891.d(17): Error: expression `i` of type `immutable(int)` is not implicitly convertible to type `out int` of parameter `n` --- */ @@ -19,8 +18,3 @@ void f2(out int n = i) { ++n; } - -void f3(ref int n = prop) -{ - ++n; -} diff --git a/compiler/test/fail_compilation/issue20704.d b/compiler/test/fail_compilation/issue20704.d deleted file mode 100644 index ba91b0635724..000000000000 --- a/compiler/test/fail_compilation/issue20704.d +++ /dev/null @@ -1,39 +0,0 @@ -/* TEST_OUTPUT: ---- -fail_compilation/issue20704.d(17): Error: cannot create default argument for `ref` / `out` parameter from constant `0` -fail_compilation/issue20704.d(28): Error: template instance `issue20704.f2!int` error instantiating -fail_compilation/issue20704.d(19): Error: cannot create default argument for `ref` / `out` parameter from constant `0` -fail_compilation/issue20704.d(30): Error: template instance `issue20704.f4!int` error instantiating -fail_compilation/issue20704.d(17): Error: cannot create default argument for `ref` / `out` parameter from expression `S(0)` because it is not an lvalue -fail_compilation/issue20704.d(36): Error: template instance `issue20704.f2!(S)` error instantiating -fail_compilation/issue20704.d(17): Error: cannot create default argument for `ref` / `out` parameter from expression `null` because it is not an lvalue -fail_compilation/issue20704.d(38): Error: template instance `issue20704.f2!(C)` error instantiating ---- -*/ - -// https://issues.dlang.org/show_bug.cgi?id=20704 - -void f1(T)(const auto ref T arg = T.init) {} -void f2(T)(const ref T arg = T.init) {} -void f3(T)(const auto ref T arg = 0) {} -void f4(T)(const ref T arg = 0) {} - -struct S { int _; } -class C { int _; } - -void main () -{ - int i; - f1!int(i); - f2!int(i); - f3!int(i); - f4!int(i); - f1!int(); - f2!int(); - f3!int(); - f4!int(); - f1!S(); - f2!S(); - f1!C(); - f2!C(); -} diff --git a/compiler/test/fail_compilation/test21807.d b/compiler/test/fail_compilation/test21807.d index aaa56f970987..4c05cefa95eb 100644 --- a/compiler/test/fail_compilation/test21807.d +++ b/compiler/test/fail_compilation/test21807.d @@ -23,33 +23,3 @@ class Foo ca = getSArray(); } } - -/* -TEST_OUTPUT: ---- -fail_compilation/test21807.d(117): Error: function `addr` is not callable using argument types `(int)` -fail_compilation/test21807.d(117): cannot pass rvalue argument `S(0).i` of type `int` to parameter `return ref int b` -fail_compilation/test21807.d(106): `test21807.addr(return ref int b)` declared here ---- -*/ -#line 100 - -struct S -{ - int i; -} - -int* addr(return ref int b) -{ - return &b; -} - -class Foo2 -{ - int* ptr; - - this() - { - ptr = addr(S().i); // struct temporary - } -} diff --git a/compiler/test/fail_compilation/tolvalue.d b/compiler/test/fail_compilation/tolvalue.d index e911dff77296..ed75aa7be24c 100644 --- a/compiler/test/fail_compilation/tolvalue.d +++ b/compiler/test/fail_compilation/tolvalue.d @@ -1,18 +1,15 @@ /** TEST_OUTPUT: --- -fail_compilation/tolvalue.d(28): Error: cannot take address of template `templateFunc(T)()`, perhaps instantiate it first -fail_compilation/tolvalue.d(29): Error: cannot take address of type `int` -fail_compilation/tolvalue.d(30): Error: cannot take address of constant `3` -fail_compilation/tolvalue.d(31): Error: cannot take address of operator `$` -fail_compilation/tolvalue.d(32): Error: cannot take address of compiler-generated variable `__ctfe` -fail_compilation/tolvalue.d(33): Error: cannot take address of manifest constant `f` -fail_compilation/tolvalue.d(38): Error: cannot create default argument for `ref` / `out` parameter from constant `3` -fail_compilation/tolvalue.d(39): Error: cannot create default argument for `ref` / `out` parameter from compiler-generated variable `__ctfe` -fail_compilation/tolvalue.d(40): Error: cannot create default argument for `ref` / `out` parameter from manifest constant `f` -fail_compilation/tolvalue.d(45): Error: cannot modify constant `3` -fail_compilation/tolvalue.d(46): Error: cannot modify compiler-generated variable `__ctfe` -fail_compilation/tolvalue.d(47): Error: cannot modify manifest constant `f` +fail_compilation/tolvalue.d(25): Error: cannot take address of template `templateFunc(T)()`, perhaps instantiate it first +fail_compilation/tolvalue.d(26): Error: cannot take address of type `int` +fail_compilation/tolvalue.d(27): Error: cannot take address of constant `3` +fail_compilation/tolvalue.d(28): Error: cannot take address of operator `$` +fail_compilation/tolvalue.d(29): Error: cannot take address of compiler-generated variable `__ctfe` +fail_compilation/tolvalue.d(30): Error: cannot take address of manifest constant `f` +fail_compilation/tolvalue.d(35): Error: cannot modify constant `3` +fail_compilation/tolvalue.d(36): Error: cannot modify compiler-generated variable `__ctfe` +fail_compilation/tolvalue.d(37): Error: cannot modify manifest constant `f` --- */ @@ -33,13 +30,6 @@ void addr() auto x6 = &E.f; } -void refArg() -{ - void f0(ref int = 3) {} - void f1(ref bool = __ctfe) {} - void f3(ref E = E.f) {} -} - void inc(int lz) { 3++; diff --git a/compiler/test/runnable/overload.d b/compiler/test/runnable/overload.d index c413ade029a6..4886aa918934 100644 --- a/compiler/test/runnable/overload.d +++ b/compiler/test/runnable/overload.d @@ -1,5 +1,5 @@ /* -REQUIRED_ARGS: -preview=rvaluerefparam +REQUIRED_ARGS: EXTRA_SOURCES: imports/ovs1528a.d imports/ovs1528b.d EXTRA_SOURCES: imports/template_ovs1.d imports/template_ovs2.d imports/template_ovs3.d EXTRA_FILES: imports/m8668a.d imports/m8668b.d imports/m8668c.d diff --git a/compiler/test/runnable/structlit.d b/compiler/test/runnable/structlit.d index d4a6bd6061b1..8970254f6ce6 100644 --- a/compiler/test/runnable/structlit.d +++ b/compiler/test/runnable/structlit.d @@ -1,5 +1,5 @@ /* -REQUIRED_ARGS: -preview=rvaluerefparam +REQUIRED_ARGS: RUN_OUTPUT: --- Success diff --git a/compiler/test/runnable/template9.d b/compiler/test/runnable/template9.d index 7a55b2dbfee0..eded936076e1 100644 --- a/compiler/test/runnable/template9.d +++ b/compiler/test/runnable/template9.d @@ -1,5 +1,5 @@ /* -REQUIRED_ARGS: -preview=rvaluerefparam +REQUIRED_ARGS: PERMUTE_ARGS: EXTRA_FILES: imports/testmangle.d TEST_OUTPUT: diff --git a/compiler/test/runnable/testassign.d b/compiler/test/runnable/testassign.d index c2b8a513ee14..e7583bbaf3b9 100644 --- a/compiler/test/runnable/testassign.d +++ b/compiler/test/runnable/testassign.d @@ -1,5 +1,5 @@ /* -REQUIRED_ARGS: -preview=rvaluerefparam +REQUIRED_ARGS: TEST_OUTPUT: --- \ S1 S2a S2b S3a S3b S4a S4b diff --git a/compiler/test/runnable/xtest46.d b/compiler/test/runnable/xtest46.d index cbcbd1a97f1a..71dec3b62f84 100644 --- a/compiler/test/runnable/xtest46.d +++ b/compiler/test/runnable/xtest46.d @@ -1,4 +1,4 @@ -// REQUIRED_ARGS: -preview=rvaluerefparam +// REQUIRED_ARGS: // /* TEST_OUTPUT: --- diff --git a/compiler/test/runnable/xtest46_gc.d b/compiler/test/runnable/xtest46_gc.d index 38c136d531cd..b1a907e6c095 100644 --- a/compiler/test/runnable/xtest46_gc.d +++ b/compiler/test/runnable/xtest46_gc.d @@ -1,5 +1,5 @@ /* -REQUIRED_ARGS: -lowmem -Jrunnable -preview=rvaluerefparam +REQUIRED_ARGS: -lowmem -Jrunnable EXTRA_FILES: xtest46.d TEST_OUTPUT: --- diff --git a/druntime/test/stdcpp/src/string_test.d b/druntime/test/stdcpp/src/string_test.d index dbbccc7cd6f6..4c14b555404a 100644 --- a/druntime/test/stdcpp/src/string_test.d +++ b/druntime/test/stdcpp/src/string_test.d @@ -19,11 +19,7 @@ unittest str = "Hello again with a long long string woo"; assert(sumOfElements_val(str) == 10935); assert(sumOfElements_ref(str) == 3645); - //assert(str == std_string("Hello again with a long long string woo")); // Needs -preview=rvaluerefparam. - { - auto tmp = std_string("Hello again with a long long string woo"); // Workaround. - assert(str == tmp); - } + assert(str == std_string("Hello again with a long long string woo")); std_string str2 = std_string(Default); assert(str2.size == 0);