Summary: Template function accepting a delegate with in argument
                    doesn't compile
           Product: D
           Version: 2.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD

The following code:

void foo(T)(T delegate(in Object) dlg)

void bar()
  foo( (in Object) { return 15; } );

does not compile:

> dmd -c bug_template_in.d
bug_template_in.d(7): template does not match any
function template declaration
bug_template_in.d(7): template cannot deduce template
function from argument types !()(int delegate(const(Object) _param_0))

Replacing both instances of 'in Object' with 'const(Object)' makes the code
compile.  I think these two forms are equivalent and should both compile.


Reply via email to