function vs. delegate in a unittest

Manfred Nowak sv1999 at hotmail.com
Sun Apr 21 08:52:40 UTC 2019


On Sunday, 21 April 2019 at 06:39:37 UTC, rikki cattermole wrote:
>     static void func() {

thy for the hint, that one can use `static' to virtually lift the 
definition of a function up to the local root of the hierarchy, 
which makes my oversimplified argument invalid for unittests.

But this seems not to solve the underlying problem:

unittest{
          void f (){}
   static void fs(){}
   struct S( T){
     T* f;
     this( T)( T fl){
       f= fl;
     }
   }
//auto sf = new S !( typeof( f ))( &f );
   auto sfs= new S !( typeof( fs))( &fs);
}

Under dmd 2.085.1 this code compiles.
But replacing the comment slashes by white space gives an error:
   cannot implicitly convert expression
     [...] delegate [...] to function [...]

So that's not a problem of unittests but of templates?


More information about the Digitalmars-d mailing list