digitalmars.D.learn - Curiously Cyclic Template Pattern causes segfault?
- Patrick Jeeves (36/36) Nov 05 2014 When I tried to test out the following code the compiler
- Justin Whear (3/6) Nov 05 2014 Please file a bug report on issues.dlang.org --any compiler crash is a b...
- bearophile (6/8) Nov 05 2014 I suspect that in some cases those compiler crashes are a way for
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?
Nov 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.
Nov 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
Nov 05 2014








"bearophile" <bearophileHUGS lycos.com>