Type Inference in @safe unittests

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 22 11:25:31 PDT 2017


On 8/22/17 2:19 PM, jmh530 wrote:

> Yeah, this happens with @safe main also (below), but not for more 
> regular local blocks. Anyway, I found it very confusing as that's not 
> how I assumed @safe applied to unittests or main worked.
> 
> @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- at safe main doesn't infer anything. 
Is that true?

-Steve


More information about the Digitalmars-d-learn mailing list