Can someone explain this error?
Bill Baxter
wbaxter at gmail.com
Tue Sep 23 16:53:32 PDT 2008
On Wed, Sep 24, 2008 at 8:26 AM, Sean Kelly <sean at invisibleduck.org> wrote:
> class C
> {
> this() {}
> this( int x, int y ) {}
> }
>
> void main()
> {
> auto c = alloc!(C);
> auto d = alloc!(C)( 1, 2 );
> }
>
> T alloc(T, Params ...)( Params params )
> {
> return new T( params );
> }
>
> $ dmd test
> test.d(10): Error: expected 0 arguments, not 2
>
This is the thing Walter made work in D2 but not D1.
http://d.puremagic.com/issues/show_bug.cgi?id=493
You can sorta work around it by using nested templates. Then you can
get a calling syntax like
alloc!(C).D1_4ever;
alloc!(C).D1_4ever(1,2);
--bb
More information about the Digitalmars-d-learn
mailing list