Bug 15379 – "final" attribute on function parameter

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-11-24T22:53:58Z
Last change time
2022-07-29T08:44:41Z
Keywords
pull
Assigned to
No Owner
Creator
Johan Engelen
Blocks
10233

Comments

Comment #0 by jbc.engelen — 2015-11-24T22:53:58Z
The grammar on Dlang.org tells me that "final" is a valid attribute on function parameters (see "InOutX"), however I cannot find documentation of what that means. dmd does not accept it on normal function parameters, only on template parameters: void foo(final int a); // error! void bar(T)(final T a); // OK We should either add documentation on what "final" means for a function parameter, or fix the grammar if it is (no longer?) supported. Thanks for any explanation, Johan
Comment #1 by dlang-bot — 2022-07-24T12:38:05Z
@ntrel created dlang/dlang.org pull request #3354 "Fix Issue 15379 - "final" attribute on function parameter" fixing this issue: - Fix Issue 15379 - "final" attribute on function parameter `final` is not allowed in D2. ```d void foo(final int a){} // error! ``` ``` finalpar.d(1): Error: variable `finalpar.foo.a` cannot be `final`, perhaps you meant `const`? ``` https://github.com/dlang/dlang.org/pull/3354