[Issue 23620] 'alias this' is not respected in static array length position
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jan 15 07:50:52 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23620
--- Comment #7 from Max Samukha <maxsamukha at gmail.com> ---
(In reply to Salih Dincer from comment #6)
> // because :
>
> enum index1 = Index();
> assert(
> is(typeof(index1) == struct)
> );
>
> auto index2 = Index();
> assert(
> !is(typeof(index1) == size_t) &&
> !is(typeof(index2) == size_t)
> );
>
> // but:
>
> enum index = Index();
> int[index + 1] d; // automatic conversion
> d[0] = 42; // yeah
>
> SDB at 79
I still don't understand. Static array declaration expects an integer. 'Index'
implicitly converts to an integer. Why should casts or other hacks be required?
--
More information about the Digitalmars-d-bugs
mailing list