Bug 22338 – Parser rejects basic types in UDAs

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-09-28T01:14:14Z
Last change time
2021-09-28T04:54:09Z
Assigned to
No Owner
Creator
Mathias LANG

Comments

Comment #0 by pro.mathias.lang — 2021-09-28T01:14:14Z
``` @string @int void main () {} ``` Returns: ``` onlineapp.d(1,10): Error: `@identifier` or `@(ArgumentList)` expected, not `@int` onlineapp.d(2,1): Error: no identifier for declarator `int` dmd failed with exit code 1. ``` However the following compiles just fine: ``` alias SillyParser = int; @string @SillyParser void main () { } ``` Tested with DMD v2.097.2
Comment #1 by b2.temp — 2021-09-28T04:54:09Z
This is not a bug, see https://dlang.org/spec/attribute.html#uda. The enhancement is already proposed here https://issues.dlang.org/show_bug.cgi?id=20464. *** This issue has been marked as a duplicate of issue 20464 ***