[Issue 13690] New: Curiously Recurring Template Pattern causes segfault.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Nov 5 13:46:31 PST 2014


https://issues.dlang.org/show_bug.cgi?id=13690

          Issue ID: 13690
           Summary: Curiously Recurring Template Pattern causes segfault.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: pdj9 at pitt.edu

The following causes dmd to segfault:

import std.traits;

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; };
}

This code is theoretically compilable because if it were changed to imitate the
halting problem then: if the function is declared final then there isn't a
conflict, if it isn't then the class has to be abstract.

--


More information about the Digitalmars-d-bugs mailing list