struct constructors and destructors.
Danni Coy via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 19 06:50:58 PDT 2017
Yeah somehow I read that as a question -- must be getting tired.
That makes more sense.
is there any way to
On Wed, Jul 19, 2017 at 10:34 PM, Stefan Koch via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:
> On Wednesday, 19 July 2017 at 12:23:06 UTC, Danni Coy wrote:
>
>> On Wed, Jul 19, 2017 at 7:09 PM, Stefan Koch via Digitalmars-d <
>> digitalmars-d at puremagic.com> wrote:
>>
>>
>>> What happens is this.
>>>
>>> void open()
>>> {
>>> foo = () {
>>> Foo _tmp = Foo.__ctor("test");
>>> return _tmp;
>>> } ();
>>> }
>>>
>>>
>>> Error: need 'this' for 'this' of type 'ref Foo(string s)'
>>>
>>
> I posted pseudo code to show you that you are creating a temporary.
> Which leaves the scope after assigning.
> And therefore triggers the destructor.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20170719/83e93823/attachment.html>
More information about the Digitalmars-d
mailing list