Inferred attributes errors in template function.

Paul Backus snarwin at gmail.com
Fri May 27 14:56:39 UTC 2022


On Friday, 27 May 2022 at 08:39:08 UTC, vit wrote:
> Is in dmd some flag that print errors similarly to this?:
>
> ```d
> void main()@safe pure{
> 	foo!long();
> 	foo!float();	
>     	//Error: `pure` function `D main` cannot call impure 
> function `onlineapp.foo!float.foo`
>     	//Error: potentially `pure` function 
> `onlineapp.foo!float.foo` cannot call impure function 
> `onlineapp.bar!float.bar`
>     	//Error: potentially `pure` function 
> `onlineapp.bar!float.bar` cannot access mutable static data `i`
> ```

No, there is nothing like this, at least not yet. It's being 
worked on, though.

https://github.com/dlang/dmd/pull/13957
https://github.com/dlang/dmd/pull/12383


More information about the Digitalmars-d-learn mailing list