[dmd-internals] [D-Programming-Language/dmd] 6ef6b7: Fixes Issue 5385 - Access must be checked for stat...

kenji hara k.hara.pg at gmail.com
Sun Dec 23 10:34:21 PST 2012


2012/12/24 Philippe Sigaud <philippe.sigaud at gmail.com>

> Damn tab.
>
> On Sun, Dec 23, 2012 at 6:48 PM, Philippe Sigaud <
> philippe.sigaud at gmail.com> wrote:
>
>> Kenji Hara:
>>
>>> T.tupleof generates a tuple of field *symbols*.
>>>
>>
>
> struct S
> {
>     int a,b,c;
> }
> void main()
> {
>     writeln(S.tupleof); // Error! Type S is not an expression.
> }
>
[snip]
> That's... disturbing, or maybe I'm too tired to think straight, but why
is it NOK for the former version and OK for the latter?

There seems a small diagnostic bug.
This is:
    writeln(S.tupleof); // Error! Type S is not an expression.
Same as:
    writeln(S.a, S.b, S.c);

Then all field accesses don't have correct 'this', then compilation fails.

(`S.a` represents a symbol of the first field in S.
 `s.a` represents an expression to access the first field in S, via `s`.)

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-internals/attachments/20121224/f4dfc862/attachment.html>


More information about the dmd-internals mailing list