DMD Access Violation

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 26 11:23:33 PDT 2016


On Monday, 26 September 2016 at 18:07:44 UTC, Jonathan Marler 
wrote:
> My dmd compiler gets an Access Violation when compiling this 
> code:
>
>     public template TemplateWrapper(T)
>     {
>         alias ToAlias = T;
>     }
>     public class Bar : Foo
>     {
>         TemplateWrapper!(Bar) something;
>     }
>     public class Foo
>     {
>         static class StaticClass : Bar { }
>     }
>
> If I move Foo to appear before Bar, the AccessViolation goes 
> away:
>
>     public template TemplateWrapper(T)
>     {
>         alias ToAlias = T;
>     }
>     public class Foo
>     {
>         static class StaticClass : Bar { }
>     }
>     public class Bar : Foo
>     {
>         TemplateWrapper!(Bar) something;
>     }
>
> Also, if I remove the TemplateWrapper, the AccessViolation goes 
> away:
>
>     public class Bar : Foo
>     {
>         Bar something;
>     }
>     public class Foo
>     {
>         static class StaticClass : Bar { }
>     }
>
> Does anyone else get an access violation in the first case? Is 
> this a known bug?

Cyclic dependency.
File a dmd bug please.


More information about the Digitalmars-d mailing list