Alias example should supposedly be illegal, but runs fine
Mike Franklin
slavo5150 at yahoo.com
Tue Dec 19 22:44:59 UTC 2017
On Tuesday, 19 December 2017 at 10:37:05 UTC, Michael wrote:
> On Tuesday, 19 December 2017 at 02:12:29 UTC, Mike Franklin
> wrote:
>> On Tuesday, 19 December 2017 at 02:04:34 UTC, codephantom
>> wrote:
>>
>>>> writeln(S.j);
>>>> // Error: Instance symbols cannot be used through types.
>>>
>>> I don't understand why you would say that is a bug.
>>>
>>
>> I meant that the example is wrong, and a bug report should be
>> filed to fix the example.
>>
>> Mike
>
> Hmm.. but the example is explicitly dealing with when it is
> valid to create an alias for a non-static struct member. Should
> it still not be int? Even if you cannot change it via that
> alias?
I don't quite understand what you mean. `s.i` refers to a symbol
in the compiler's symbol table. Therefore, I don't see any
reason it can't be aliased. `alias a = b + c;` would be a better
example to demonstrate that expressions cannot be aliased.
Mike
More information about the Digitalmars-d-learn
mailing list