[Issue 12620] Compiler picks lesser template specialization match for float array alias value parameters

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 3 13:33:08 PDT 2017


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

Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dlang-bugzilla at thecybershad
                   |                            |ow.net
         Resolution|---                         |INVALID

--- Comment #4 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to Andrej Mitrovic from comment #3)
> Ah, could be. I guess it makes sense to prefer matching the version which
> retains the matching type (and retains the full range of the type this way)
> rather than tries to implicitly convert it.

Err, but you can't implicitly convert a double[] to a float[].

I mean, it works when you assign it:

float[] arr = [1.0];

So does with int->byte:

byte[] arr = [1];

but int->byte conversion fails with your example too:

template Foo(alias sym)         { pragma(msg, "Foo1"); }
template Foo(alias byte[] sym)  { pragma(msg, "Foo2"); }

void main()
{
    alias foo1 = Foo!([1]);    // prints Foo1
}

So, this issue is either invalid, or it's about an enhancement request to
extend the same type of implicit conversion used for initialization / literal
assignment to alias parameters.

Seeing how this issue as initially formulated was based on a misunderstanding,
and that it was filed 3 years ago, I'll be closing this, but feel free to
reopen if you disagree.

--


More information about the Digitalmars-d-bugs mailing list