Thread overview
Curiously Cyclic Template Pattern causes segfault?
Nov 05, 2014
Patrick Jeeves
Nov 05, 2014
Justin Whear
Nov 05, 2014
bearophile
November 05, 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?
November 05, 2014
On Wed, 05 Nov 2014 20:48:06 +0000, Patrick Jeeves wrote:

> When I tried to test out the following code the compiler segfaulted:
> 
> Is there some rule against doing this or is it a glitch?

Please file a bug report on issues.dlang.org --any compiler crash is a bug regardless of whether the source is valid D code or not.
November 05, 2014
Justin Whear:

> --any compiler crash is a bug
> regardless of whether the source is valid D code or not.

I suspect that in some cases those compiler crashes are a way for the compiler to tell the programmer that the code was too much hairy and too much hard to understand ;-)

Bye,
bearophile