refInt = ref int: how to achieve this? or is this a bug?

Stanislav Blinov stanislav.blinov at gmail.com
Wed Jun 17 23:09:55 UTC 2020


On Wednesday, 17 June 2020 at 23:05:59 UTC, mw wrote:
> On Wednesday, 17 June 2020 at 22:48:25 UTC, MoonlightSentinel 
> wrote:
>> But i would agree with you that there is a bug in your initial
>
> It's not the bug in my code,
>
>> code, the `ref` should be rejected.
>
> it's the compiler's bug not rejecting it, given it's current 
> semantics; instead it *silently* treat alias `ref int` as `int`.

It is both. In your code, for trying to use `ref` as a type 
qualifier when it is not (see [1] for type qualifiers), and in 
the compiler, for not issuing an error.

[1] https://dlang.org/spec/const3.html


More information about the Digitalmars-d mailing list