Confusing "Error: only one index allowed to index [...]"
Steven Schveighoffer
schveiguy at gmail.com
Fri Jan 4 16:16:03 UTC 2019
On 1/2/19 6:37 PM, Bastiaan Veelo wrote:
> On Wednesday, 2 January 2019 at 22:49:45 UTC, Steven Schveighoffer wrote:
>> What is happening is the compiler is evaluating expressions:
>>
>> a[1] resolves just fine, because of the int[] alias this. But then you
>> are trying to index the result, which is an int.
>
> Indeed, this is one of the things I described :-)
>
>> So no, this error cannot be improved, [...]
>
> I think yes, because the message is: “Error: only one index allowed to
> index `int`“ whereas it should be “Error: cannot index type `int`“. Right?
Yes, that error is super-misleading. I should have narrowed my focus of
my retraction, I take it back that the alias this is a problem.
-Steve
More information about the Digitalmars-d
mailing list