Why is my @pure function @system when placed in a struct?
    Dukc 
    ajieskola at gmail.com
       
    Wed Feb 27 18:10:11 UTC 2019
    
    
  
On Wednesday, 27 February 2019 at 17:23:21 UTC, Q. Schroll wrote:
> For whatever reason, when I put the code in a struct, the @safe 
> testing line tells me, it's @system now.
I tested a bit, and it appears that attribute inference is not 
done at all for templates inside structs -the attribute need not 
be a delegate:
struct S
     {
         static int fImpl(Ret)() { return Ret.init; }
         pragma(msg, __traits(getFunctionAttributes, fImpl!int)); 
// still tells us: `f` is @system
     }
void main(){}
A bug, unless I'm overlooking something.
    
    
More information about the Digitalmars-d-learn
mailing list