[Issue 13777] Value range propagation faild on array function argument

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Nov 27 22:40:15 PST 2014


https://issues.dlang.org/show_bug.cgi?id=13777

--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Denis Shelomovskij from comment #0)
> This code used to work:
> ---
> T select(T)(in size_t idx, T[2] values...)
> {
>     return values[idx];
> }
> 
> void main()
> {
>     ubyte ub = select(0, 3, 4);
> }
> ---

With 2.057 to 2.066 and git-head, the code fails to compile because T is
deduced to int and an int function return is not always implicitly convertible
to ubyte.

Which dmd version had you used? If the code has been accepted with certain dmd
release, it was definitely an accepts-invalid bug.

> In case it was an accept-invalid bug, a clear reason to disallow the feature
> should be stated as it breaks user code without any deprecation cycle.

Bugfix does not need deprecation cycle.

--


More information about the Digitalmars-d-bugs mailing list