Can someone explain this error?

Sean Kelly sean at invisibleduck.org
Wed Sep 24 10:59:29 PDT 2008


Bill Baxter wrote:
>>>> I'm pretty sure it's possible to partially specify a template.  Consider:
>>>>
>>>>    void main()
>>>>    {
>>>>        fn!(int)( 5 );
>>>>    }
>>>>
>>>>    void fn(A, B)( B b ) {}
>>>>
>>>> This works just fine, but if I change the function declaration to:
>>>>
>>>>    void fn(A, B ...)( B b ) {}
>>>>
>>>> it fails.  Are variadic templates a special case?
>>>>
>>> Uh, what compiler are you using?  That fails for me (1.034).
>> 2.019
> 
> It seems all Andrei's usages of the feature in std.algorithm have an
> alias parameter as the first, followed by the variadic.
> 
> So maybe this is just a code path in the compiler that hasn't been
> tickled previously.
> Does your code work if you make the first param an alias?

No.  Weird, huh?

     void main()
     {
         int x;
         fn!(x)( 5 );
     }

     void fn(alias a, B ...)( B b ) {}


Sean


More information about the Digitalmars-d-learn mailing list