www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMD bug

reply "Eric" <eric makechip.com> writes:
The following code will cause the compiler to crash:

import std.traits;

interface Identity(V, K) if (hasMember!(V, "k")) {
}

class Foo(K): Identity!(Foo!K, K) {
     K k;
}

void main() {
     new Foo!double;
}

This occurs on both compiler versions, 2.062 and 
v2.063-devel-53aa503.

At a minimum the compiler should print an error message instead
of seg-faulting, but I would hope that the above code would 
actually compile
successfully.

-Eric
Jun 08 2013
next sibling parent "Eric" <eric makechip.com> writes:
On Saturday, 8 June 2013 at 18:05:16 UTC, Eric wrote:
 The following code will cause the compiler to crash:

 import std.traits;

 interface Identity(V, K) if (hasMember!(V, "k")) {
 }

 class Foo(K): Identity!(Foo!K, K) {
     K k;
 }

 void main() {
     new Foo!double;
 }

 This occurs on both compiler versions, 2.062 and 
 v2.063-devel-53aa503.

 At a minimum the compiler should print an error message instead
 of seg-faulting, but I would hope that the above code would 
 actually compile
 successfully.

 -Eric
I should also add that many of the "functions" in std.traits will cause the compiler to crash when used to constrain an interface in this manner.
Jun 08 2013
prev sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 6/8/2013 11:05 AM, Eric wrote:
 The following code will cause the compiler to crash:
All bug reports should be posted here: http://d.puremagic.com/issues/
Jun 08 2013