static assert "argument has no parameters"
Christopher Wright
dhasenan at gmail.com
Fri Jul 20 19:38:26 PDT 2007
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.
More information about the Digitalmars-d-learn
mailing list