Initializing a table of delegates with no-op stubs

Arine arine123445128843 at gmail.com
Sat Jan 11 20:41:39 UTC 2020


On Saturday, 11 January 2020 at 14:51:24 UTC, Steven 
Schveighoffer wrote:
> In any case, here is a solution that works and is pretty 
> reasonable:

I think there's probably a check that just stops delegates 
completely from being default initialized in structs.

  	struct S {
  		void delegate(int) dg2 = cast(void delegate(int)) function 
(int x) {};
  	}

That has the same error message.

Just cause there's a (hacky) workaround, doesn't mean the most 
intuitive way to do it shouldn't be fixed.


More information about the Digitalmars-d mailing list