http://d.puremagic.com/issues/show_bug.cgi?id=7135



--- Comment #2 from Andrei Alexandrescu <and...@metalanguage.com> 2011-12-31 
00:40:00 PST ---
(In reply to comment #1)
> This is not the delegate literal type deduction problem.
> It is a trivial mismatching of delegate types.
> 
> This is the reduced code to explain the problem.
> ----
> struct Variant {}
> class Dynamic {}
> alias Variant delegate(Dynamic self, Variant[] args...) DynMethod;
> void main()
> {
>     DynMethod dg = delegate Variant(Dynamic, Variant[]) {
>         return Variant();
>     };
> }
> 
> Output:
> ----
> test.d(6): Error: cannot implicitly convert expression (__dgliteral1) of type
> Variant delegate(Dynamic _param_0, Variant[] _param_1) pure nthrow @safe to
> Variant delegate(Dynamic self, Variant[] args...)
> 
> DynMethod has typesafe variadic parameter, but literal doesn't have.
> So this is a bug of TDPL sample code, not compiler's.

I think (and perhaps I'm wrong) that the signature with ... and the one without
must be equivalent. The ... makes a difference only in the call syntax, but in
fact still passes an array. (Note that the variadics ending with "T[] param..."
are not unsafe C-style variadics.) Please advise - thanks!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to