Bug 23847 – Error with regards to lambda function is confusing

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2023-04-20T08:27:05Z
Last change time
2024-12-13T19:28:20Z
Assigned to
No Owner
Creator
RazvanN
Moved to GitHub: dmd#20261 →

Comments

Comment #0 by razvan.nitu1305 — 2023-04-20T08:27:05Z
void main() { immutable int c; int function(int x) func; func = x => c; } (13): Error: function `main.__lambda3(__T1)(x)` cannot access variable `c` in frame of function `D main` There are 2 problems: 1. __lambda3 is a compiler generated identifier that should not see the light of a screen. 2. the compiler say `function` but what it outputs is actually a template declaration. A better error message would look like: "Error: lambda function: `x => c` cannot access variable `c` in frame of function main.
Comment #1 by robert.schadek — 2024-12-13T19:28:20Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20261 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB