Bug 11064 – D should support attribute blocks inside functions

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-18T07:45:08Z
Last change time
2024-12-13T18:11:34Z
Assigned to
No Owner
Creator
rswhite4
Moved to GitHub: dmd#17611 →

Comments

Comment #0 by rswhite4 — 2013-09-18T07:45:08Z
Code: ---- const { /// [1] int a = 3; } void main() { const { /// [2] int b = 4; } } ---- [1] is currently supported, but [2] not. I see no reason for this limitation. debug statements behave the same way: debug { /// debug code } So the same should also apply to const and immutable and maybe also for pure, nothrow etc.
Comment #1 by john.michael.hall — 2018-07-25T21:21:05Z
I couldn't agree more. I just came across this [1]. It also applies to UDAs. I was trying to figure out how to add a UDA to an instance of a struct and then potentially change the behavior of the struct depending on the UDA. For instance, to enable one to control whether casting is allowed within a block. [1] https://forum.dlang.org/post/[email protected]
Comment #2 by b2.temp — 2020-06-13T18:36:55Z
*** Issue 17911 has been marked as a duplicate of this issue. ***
Comment #3 by robert.schadek — 2024-12-13T18:11:34Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17611 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB