Diagnostics for redundant qualifiers

Walter Bright newshound2 at digitalmars.com
Thu Jul 29 17:22:28 UTC 2021


On 7/28/2021 11:54 AM, Per Nordlöw wrote:
> What about making
> 
> ```d
> @safe struct S  {
>     void f() @safe {}
> }
> ```
> 
> warn or deprecate as
> 
> ```
> Warning: redundant function attribute `@safe`
> ```
> 
> ?

The compiler will complain about:

     @safe @safe void test();

but not:

     @safe { @safe void test(); }
     @safe: @safe void bar();

This is quite deliberate. It's the same for all the attributes.

Nicholas has the right justification.


More information about the Digitalmars-d mailing list