www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13030] New: DMD assertion fails at mtype.c:697 if delegate


          Issue ID: 13030
           Summary: DMD assertion fails at mtype.c:697 if delegate has an
                    argument name
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: liran weka.io

The following code:

void va(Args...)(const Args args) {}

void func(int delegate(int n) a)

causes an assertion in dmd:
dmd: mtype.c:697: void Type::fixTo(Type*): Assertion `mod != t->mod' failed.

If the name of the delegate argument is removed [no 'n'] it compiles.

If the called function has just a single template [void mva(T)(const T args)]
it compiles.

If the called functions receives non const args [void mva(A...)(A args)] it
also compiles.

This is the minimal set of lines that I was able to get to in order to recreate
the assertion error.

DMD64 D Compiler v2.065, fails on Linux and Mac OSX.(Did not try on other

Jul 03 2014