is this a bug ? mixin template static function missing!

learnfirst1 learnfirst1 at gmail.com
Fri Aug 10 12:31:17 UTC 2018


On Friday, 10 August 2018 at 12:05:52 UTC, Simen Kjærås wrote:
> On Friday, 10 August 2018 at 11:17:10 UTC, learnfirst1 wrote:
> If you try the same without the mixin template, you'll see that 
> it doesn't work:
>


struct Test {
     extern(C) pragma(crt_constructor) static void init(){ // work
         int i = 3;
     }
}

void main(){
     extern(C) pragma(crt_constructor) static void init(){ // not 
work
         int i = 3;
     }
}

------------------------------

It not work make no sense, since it can work on struct.


I am not be able to search the related spec docs,  only this 
link:  
https://dlang.org/blog/2018/01/04/dmd-2-078-0-has-been-released/

Based on my understand, nested static  extern(C)  function is all 
about visibility.  It just like put private before it,  there is 
really no reason to treat them in diff way.





More information about the Digitalmars-d-learn mailing list