Is this a bug?
Rene Zwanenburg via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jun 26 03:09:52 PDT 2014
I /think/ this is a bug, but I'm not 100% sure. The following
compiles without any problems, as it should:
import std.typecons;
alias Handle(T) = RefCounted!(T, RefCountedAutoInitialize.no);
auto initialized(T)() if(is(T == RefCounted!S, S...))
{
T refCounted;
refCounted.refCountedStore.ensureInitialized();
return refCounted;
}
alias S = Handle!S_Impl;
struct S_Impl
{
}
void main()
{
auto s = initialized!S;
}
Change 'initialized' to:
auto initialized(T)() if(is(T == Handle!S, S))
and the compiler will complain:
Error: template instance test.initialized!(RefCounted!(S_Impl,
cast(RefCountedAutoInitialize)0)) does not match template
declaration initialized(T)() if (is(T == Handle!S, S))
More information about the Digitalmars-d
mailing list