Challenge: write a reference counted slice that works as much as possible like a built-in slice
Walter Bright
newshound2 at digitalmars.com
Wed Dec 15 10:10:31 UTC 2021
On 12/14/2021 7:51 AM, Atila Neves wrote:
> On Tuesday, 14 December 2021 at 12:14:52 UTC, Tejas wrote:
>> Sorry for reviving this thread, was just sifting through...
>> The following code also outputs `dtor!`, unfortunately :(
>>
>> ```d
>>
>> import std.stdio:writeln;
>>
>> struct S{
>> @disable this();
>> ~this(){
>> writeln("dtor!");
>> }
>> }
>>
>> void main(){
>> S s = void;
>> }
>>
>> ```
>>
>> Compiler :
>> LDC - the LLVM D compiler (1.25.0):
>> based on DMD v2.095.1 and LLVM 11.1.0
>
> Is there an issue for this?
Should there be? Using void initialization means it's up to the user to
initialize it properly before use.
More information about the Digitalmars-d
mailing list