Trouble with destroy

Namespace rswhite4 at googlemail.com
Mon Sep 23 12:11:52 PDT 2013


On Monday, 23 September 2013 at 19:06:48 UTC, Namespace wrote:
> Code:
> ----
> import std.stdio;
>
> struct A {
> public:
> 	int[4] val;
> 	
> 	alias val this;
> }
>
> void main()
> {
> 	A a;
> 	a.destroy();
> }
> ----
>
> /d824/f630.d(13): Error: template object.destroy matches more 
> than one template declaration, 
> /opt/compilers/dmd2/include/object.di(593):destroy(T)(ref T 
> obj) if (is(T == struct)) and 
> /opt/compilers/dmd2/include/object.di(604):destroy(T : U[n], U, 
> ulong n)(ref T obj)
>
> Nice. What should I do?

As always. As soon as you wrote it, you've got the solution.
----
destroy!A(a);
----


More information about the Digitalmars-d-learn mailing list