[Issue 19706] Attribute inference in struct fails
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Mar 25 13:32:04 UTC 2019
    
    
  
https://issues.dlang.org/show_bug.cgi?id=19706
Eduard Staniloiu <edi33416 at gmail.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |edi33416 at gmail.com
--- Comment #1 from Eduard Staniloiu <edi33416 at gmail.com> ---
If you change the return type of your function to `auto`, pragma will output
the expected `tuple("pure", "nothrow", "@nogc", "@safe")` function attributes.
What is more interesting is that even if you don't change the return type, you
can safely call the function in a `@safe` function and the deduction is correct
```
struct S
{
  static int fImpl(Ret)() { return Ret.init; }
  @safe void bar() { fImpl!int(); }
}
```
Will compile just fine
--
    
    
More information about the Digitalmars-d-bugs
mailing list