Curiously Cyclic Template Pattern causes segfault?
    Patrick Jeeves via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Wed Nov  5 12:48:06 PST 2014
    
    
  
When I tried to test out the following code the compiler 
segfaulted:
interface BarBase
{
	void do_a_thing();
}
interface Bar(T) : BarBase
{
	static if(hasMember!(T, "rotation") && is(typeof(T.rotation) == 
double))
	{
		@property
		double rotation();
		
		final void do_a_thing()
		{
			//do a thing with rotation;
		}
	}
	else
	{
		final void do_a_thing()
		{
			//do a thing without rotation;
		}
	}
}
class Foo1 : Bar!Foo1
{
}
class Foo2 : Bar!Foo2
{
	@property
	double rotation() { return 1.0; };
}
Is there some rule against doing this or is it a glitch?
    
    
More information about the Digitalmars-d-learn
mailing list