On Tuesday, 22 August 2017 at 18:25:31 UTC, Steven Schveighoffer wrote:

@safe void main()
{
     struct Foo {
         int foo(int i, string s) @safe { return 0; }
         double foo2(string s) @safe { return 0; }
     }
     printMemberTypes!(Foo);
}

The surprising part to me is that non-@safe main doesn't infer anything. Is that true?

-Steve

They aren't auto functions or templates, just normal member functions of a struct in main. I thought inferring function attributes was only for auto functions and templates. I never thought it would for member functions of structs in main. But yeah, I'm pretty those functions are @safe and not @safe @nogc nothrow pure.

Reply via email to