Skip to content

Lambda as UDA is valid but spec requires brackets #4137

Closed
dlang/dmd
#21009
@dlangBugzillaToGithub

Description

@dlangBugzillaToGithub

Richard (Rikki) Andrew Cattermole reported this on 2024-01-20T01:25:08Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=24346

CC List

Description

From: https://forum.dlang.org/post/[email protected]

The lambda here is valid, even though it is not in a brackets.

```d
@a=>7 int b;
pragma(msg, __traits(getAttributes, b)); // AliasSeq!((a) => 7)
```

Should only be supported (according to specification):

```d
@(a=>7) int b;
pragma(msg, __traits(getAttributes, b)); // AliasSeq!((a) => 7)
```

Clarification or a compiler bug fix is needed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions