Re: auto ref escaping local variable

2017-01-24 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, January 24, 2017 11:16:21 Ali Çehreli via Digitalmars-d wrote: > On 01/24/2017 02:03 AM, Jonathan M Davis via Digitalmars-d wrote: > > On Tuesday, January 24, 2017 00:47:31 Ali Çehreli via Digitalmars-d > Obviously, I know all of that and they are pretty complicated for new >

Re: auto ref escaping local variable

2017-01-24 Thread Ali Çehreli via Digitalmars-d
On 01/24/2017 02:03 AM, Jonathan M Davis via Digitalmars-d wrote: > On Tuesday, January 24, 2017 00:47:31 Ali Çehreli via Digitalmars-d wrote: >> The problem with auto ref is that in the case of rvalues, what you have >> is a local variable, which makes it almost given that when it's 'auto >>

Re: auto ref escaping local variable

2017-01-24 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, January 24, 2017 00:47:31 Ali Çehreli via Digitalmars-d wrote: > On 01/24/2017 12:12 AM, Patrick Schluter wrote: > > On Tuesday, 24 January 2017 at 06:51:40 UTC, Stefan Koch wrote: > >> On Tuesday, 24 January 2017 at 00:52:34 UTC, Robert burner Schadek > > wrote: > >>> I have this

Re: auto ref escaping local variable

2017-01-24 Thread Nordlöw via Digitalmars-d
On Tuesday, 24 January 2017 at 08:49:17 UTC, Ali Çehreli wrote: On 01/24/2017 12:47 AM, Ali Çehreli wrote: > Lvalues are passed by reference and rvalues are copied. I keep making that mistake! Despite the by-copy syntax, rvalues are moved. Ali Further note that you can use conditional

Re: auto ref escaping local variable

2017-01-24 Thread Ali Çehreli via Digitalmars-d
On 01/24/2017 12:47 AM, Ali Çehreli wrote: > Lvalues are passed by reference and rvalues are copied. I keep making that mistake! Despite the by-copy syntax, rvalues are moved. Ali

Re: auto ref escaping local variable

2017-01-24 Thread Ali Çehreli via Digitalmars-d
On 01/24/2017 12:12 AM, Patrick Schluter wrote: > On Tuesday, 24 January 2017 at 06:51:40 UTC, Stefan Koch wrote: >> On Tuesday, 24 January 2017 at 00:52:34 UTC, Robert burner Schadek wrote: >>> I have this program that used to compile with 72 but with 73 dmd is >>> complaining that >>> "Error:

Re: auto ref escaping local variable

2017-01-24 Thread Patrick Schluter via Digitalmars-d
On Tuesday, 24 January 2017 at 06:51:40 UTC, Stefan Koch wrote: On Tuesday, 24 January 2017 at 00:52:34 UTC, Robert burner Schadek wrote: I have this program that used to compile with 72 but with 73 dmd is complaining that "Error: escaping reference to local variable t" auto ref f2(T)(auto

Re: auto ref escaping local variable

2017-01-23 Thread Stefan Koch via Digitalmars-d
On Tuesday, 24 January 2017 at 00:52:34 UTC, Robert burner Schadek wrote: I have this program that used to compile with 72 but with 73 dmd is complaining that "Error: escaping reference to local variable t" auto ref f2(T)(auto ref T t, auto ref T s) { return t; } auto ref f1(T)(auto

Re: auto ref escaping local variable

2017-01-23 Thread Robert burner Schadek via Digitalmars-d
Nice idea, but didn't work either. Just got more errors. And my eyes hurt now.

Re: auto ref escaping local variable

2017-01-23 Thread Manu via Digitalmars-d
On 24 January 2017 at 10:52, Robert burner Schadek via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > I have this program that used to compile with 72 but with 73 dmd is > complaining that > "Error: escaping reference to local variable t" > > auto ref f2(T)(auto ref T t, auto ref T s) { >

auto ref escaping local variable

2017-01-23 Thread Robert burner Schadek via Digitalmars-d
I have this program that used to compile with 72 but with 73 dmd is complaining that "Error: escaping reference to local variable t" auto ref f2(T)(auto ref T t, auto ref T s) { return t; } auto ref f1(T)(auto ref T t, auto ref T s) { return f2(t, s); } unittest { int