Curiously Cyclic Template Pattern causes segfault?

2014-11-05 Thread Patrick Jeeves via Digitalmars-d-learn


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?


Re: Curiously Cyclic Template Pattern causes segfault?

2014-11-05 Thread Justin Whear via Digitalmars-d-learn
On Wed, 05 Nov 2014 20:48:06 +, 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.


Re: Curiously Cyclic Template Pattern causes segfault?

2014-11-05 Thread bearophile via Digitalmars-d-learn

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