Issue with std.typecons.scoped and Interfaces

Jonathan M Davis jmdavisProg at gmx.com
Tue Aug 16 00:25:47 PDT 2011


On Tuesday, August 16, 2011 00:10:20 Andrew Wiley wrote:
> On Mon, Aug 15, 2011 at 11:31 PM, Jonathan M Davis 
<jmdavisProg at gmx.com>wrote:
> > On Tuesday, August 16, 2011 02:03:45 Andrew Wiley wrote:
> Yes, it makes no sense to allocate an instance of an interface. I don't see
> how that's relevant here.

I obviously skimmed over your question too quickly. My apologies.

Okay, looking at std.typecons, it looks like what's happening is that it's 
barfing when it tries to instantiate destroy to clean up the object in 
Scoped!T's destructor. And when it does that, it calls each destructor along 
the inheritance path, and destroy doesn't work with interfaces.

I'd suggest that you create a bug report for it. Obviously, scoped needs some 
reworking to make it handle interfaces in the inheritance path. They obviously 
don't need to be destroyed, but since it doesn't special-case interfaces, it 
tries to destroy them, which doesn't compile, so the scoped doesn't compile.

- Jonathan M Davis


More information about the Digitalmars-d mailing list