Issue 24784 - Error on first lambda parameter with default with type inference
Summary: Error on first lambda parameter with default with type inference
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: Bolpat
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2024-09-25 16:32 UTC by Bolpat
Modified: 2024-09-26 17:32 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Bolpat 2024-09-25 16:32:09 UTC
Example:
```d
alias fp = (x = 0) { }; // Error: undefined identifier `x`
```
Comment 1 Nick Treleaven 2024-09-26 16:13:11 UTC
When there's a default initializer, I think the Identifier is parsed as a type:

struct X {}
alias fp = (X = X.init) {
  pragma(msg, is(X)); return 0; }; // true
enum e = fp(X());

See Issue 12814.
Comment 2 Bolpat 2024-09-26 17:22:10 UTC
I’ll try to fix this.
Comment 3 Dlang Bot 2024-09-26 17:32:32 UTC
@Bolpat created dlang/dmd pull request #16889 "Fix Bugzilla Issue 24784" fixing this issue:

- Fix Bugzilla Issue 24784

https://github.com/dlang/dmd/pull/16889