new A().b() currently requires extra brackets/parentheses

Timon Gehr timon.gehr at gmx.ch
Mon Sep 10 06:39:41 PDT 2012


On 09/10/2012 09:01 AM, Sönke Ludwig wrote:
> Am 09.09.2012 16:43, schrieb Timon Gehr:
>> On 09/09/2012 03:28 PM, Timon Gehr wrote:
>>> ...
>>>
>>> I think so. Probably it is just a bug. (the spec does not indicate that
>>> it is illegal iirc.)
>>
>> I was wrong, the grammar actually precludes this, so it has to be
>> changed as well. Anyway, this is the pull request:
>> https://github.com/D-Programming-Language/dmd/pull/1111
>>
>>
>
> Does the following also work?
>
> class A {
> 	static class B {
> 		int x;
> 	}
> }
>
> new A.B.x = 1;
>

A.B.x is not a type.

new A.B().x = 1 works.


More information about the Digitalmars-d mailing list