[Issue 7071] "final:" shouldn't affect variables

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 6 12:30:35 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=7071

--- Comment #6 from RazvanN <razvan.nitu1305 at gmail.com> ---
If final is applied directly to the declaration, the compiler will issue an
error:

class C
{
    final string s; // error: cannot apply final to variable declarations;
}

However, if final is used as in the original bug report, it is simply ignored.
The dmd philosophy for attributes that apply to block declarations is to apply
the attribute where possible and to ignore it where it cannot be applied.
Precedent: https://github.com/dlang/dmd/pull/7229

--


More information about the Digitalmars-d-bugs mailing list