Is this a bug?

Eric via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 15 11:28:58 PDT 2016


On Friday, 15 April 2016 at 18:22:02 UTC, Eric wrote:
> On Friday, 15 April 2016 at 17:43:59 UTC, ag0aep6g wrote:
>> On 15.04.2016 19:13, Eric wrote:
>>>    1 alias J = const C;
>>>    2
>>>    3 void main(string[] args)
>>>    4 {
>>>    5     J a = new C();
>>>    6     I!(J) i = a;
>>>    7 }
>>>    8
>>>    9 interface I(V) { }
>>>   10
>>>   11 class F(V) if (is(V : I!(V))) { }
>>>   12
>>>   13 class C : I!(J)
>>>   14 {
>>>   15     F!(J) m;
>>>   16 }
>>>
>>
>> Line 6 isn't accepted either. If you remove the constraint, 
>> the compiler complains about it. So it's just the next error 
>> in line.
>>
>> And really const C can't be converted to I!(const C) 
>> implicitly. The former is const, the latter is mutable => no 
>> go.
>
>
> Thanks. I see that now.  Is there any way I can make the 
> compiler
> understand that the interface is const?
>
> -Eric

line 6 can be fixed like this: "const I!(J) i = a;"
Now if I can just figure out how to fix line 15...




More information about the Digitalmars-d-learn mailing list