View mode: basic / threaded / horizontal-split · Log in · Help
July 20, 2007
static assert "argument has no parameters"
I made some changes to my program, and suddenly I am getting this error:

11:13:58.44>build -I..;c:\dmd\import -version=gui -version=Phobos OpenProjs.d
c:\dmd\src\phobos\std\traits.d(72): static assert  "argument has no parameters"

I could probably do some undo's and get it back to where it compiles, but,
just wanted to let you know about this one. This is using dmd version,

11:14:07.81>dmd
Digital Mars D Compiler v1.018
Copyright (c) 1999-2007 by Digital Mars written by Walter Bright
Documentation: http://www.digitalmars.com/d/1.0/index.html

Any thoughts?
July 20, 2007
Re: static assert "argument has no parameters"
Reply to jicman,

> I made some changes to my program, and suddenly I am getting this
> error:
> 
> 11:13:58.44>build -I..;c:\dmd\import -version=gui -version=Phobos
> OpenProjs.d c:\dmd\src\phobos\std\traits.d(72): static assert
> "argument has no parameters"
> 
> I could probably do some undo's and get it back to where it compiles,
> but, just wanted to let you know about this one. This is using dmd
> version,
> 

take a look at c:\dmd\src\phobos\std\traits.d(72) (it's part of phobos) 

It is in the ParameterTypeTuple template and I would guess from the looks 
of it you are using it with a non-function type.

BTW static assert errors are D's way of letting code define it's own errors.
July 21, 2007
Re: static assert "argument has no parameters"
BCS wrote:
> Reply to jicman,
> 
>> I made some changes to my program, and suddenly I am getting this
>> error:
>>
>> 11:13:58.44>build -I..;c:\dmd\import -version=gui -version=Phobos
>> OpenProjs.d c:\dmd\src\phobos\std\traits.d(72): static assert
>> "argument has no parameters"
>>
>> I could probably do some undo's and get it back to where it compiles,
>> but, just wanted to let you know about this one. This is using dmd
>> version,
>>
> 
> take a look at c:\dmd\src\phobos\std\traits.d(72) (it's part of phobos)
> It is in the ParameterTypeTuple template and I would guess from the 
> looks of it you are using it with a non-function type.
> 

More likely it's being used with a function that doesn't take 
parameters, like the error message stated. ParameterTypeTuple could 
return an empty tuple in that case but doesn't. I've submitted a patch 
that would fix the issue, but it hasn't been accepted.

On the other hand, my patch would return an empty tuple if you gave it 
an integer, a string, a struct, a wedge of cheese....so maybe that's not 
the most reliable answer.

ReturnType is in a similar situation; give it a void function and it'll 
static assert you. Of course, you generally do need to have a special 
case for void functions, but in that case we would want a separate 
IsNotVoid template.
Top | Discussion index | About this forum | D home