Is there something special required to use Appender.clear
bauss
jj_1337 at live.dk
Tue Mar 27 12:25:23 UTC 2018
On Tuesday, 27 March 2018 at 12:17:58 UTC, Ellie Harper wrote:
> Sorry if this is a stupid question, but is there something
> special required to call Appender.clear? When I attempt even
> just a simple use I am getting compile errors relating to
> `template object.clear`.
>
> When I try:
>
> import std.array;
>
> void main(string[] args){
> auto foo = appender!string;
> foo.clear;
> }
>
> I receive the following output:
>
> $ ldc2 source/tmp.d
> source/tmp.d(5): Error: template object.clear cannot deduce
> function from argument types !()(Appender!string), candidates
> are:
> /usr/local/include/d/ldc/object.d(2041):
> object.clear(T : Value[Key], Value, Key)(T aa)
> /usr/local/include/d/ldc/object.d(2046):
> object.clear(T : Value[Key], Value, Key)(T* aa)
>
> $ dmd source/tmp.d
> source/tmp.d(5): Error: template object.clear cannot deduce
> function from argument types !()(Appender!string), candidates
> are:
> /usr/include/dmd/druntime/import/object.d(1983):
> object.clear(T : Value[Key], Value, Key)(T aa)
> /usr/include/dmd/druntime/import/object.d(1988):
> object.clear(T : Value[Key], Value, Key)(T* aa)
>
>
> versions:
>
> $ dmd --version
> DMD64 D Compiler v2.078.0
> Copyright (c) 1999-2017 by The D Language Foundation
> written by Walter Bright
>
> $ ldc2 --version
> LDC - the LLVM D compiler (1.8.0git-921bb7f):
> based on DMD v2.078.3 and LLVM 4.0.1
> built with DMD64 D Compiler v2.078.0
>
>
> Is there something I am missing here?
>
> Thanks
I would say that's a bug, because it seems like it's trying to
get the clear() function used for associative arrays.
More information about the Digitalmars-d-learn
mailing list