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