template parameter inference and introspection
Meta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Feb 24 06:06:22 PST 2017
On Friday, 24 February 2017 at 11:17:46 UTC, John Colvin wrote:
> Unfortunately that only works by accident of my example. A
> counterexample:
>
> T foo(Q = float, T = short)(T t) { return t; }
>
> alias Typeof(alias v) = typeof(v);
>
> template getInstantiation(alias f, T...)
> {
> import std.meta;
>
> alias getInstantiation = f!(staticMap!(Typeof, T));
> }
>
> static assert(is(typeof(foo(3)) == int)); // ok
> static assert(is(typeof(getInstantiation!(foo, 3)(3)) == int));
> // fails
This looks like VRP is kicking in when it shouldn't, or maybe
it's a different bug. 3 should be typed as int by default unless
we explicitly ask for something else.
More information about the Digitalmars-d-learn
mailing list