Bug 23311 – Allow creating alias for __gshared

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-08-29T13:36:05Z
Last change time
2022-09-01T13:17:30Z
Assigned to
No Owner
Creator
ryuukk_

Comments

Comment #0 by ryuukk.dev — 2022-08-29T13:36:05Z
The following code doesn't compile ``` alias notls = __gshared; ``` onlineapp.d(2): Error: basic type expected, not `;` onlineapp.d(2): Deprecation: storage class `__gshared` has no effect in type aliases __gshared is annoying to type, and doesn't convey the proper intention Being able to alias it would solve my problem `shared` is not a solution
Comment #1 by razvan.nitu1305 — 2022-09-01T13:17:30Z
I'm sorry, but this bug report is invalid. By the current spec, aliases can only be made to types or symbols, whereas __gshared is a type qualifier just like const, immutable etc. You cannot do `alias im = immutable`. `__gshared` is ugly and hard to type on purpose, because it is unsafe and requires that the programmer really understands what he/she is doing. I will close this as WONTFIX.