Bug 21061 – Bad error: function D main is a nested function and cannot be accessed from reduce

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-07-20T22:39:11Z
Last change time
2024-12-13T19:10:14Z
Assigned to
No Owner
Creator
Iain Buclaw
Moved to GitHub: dmd#17972 →

Comments

Comment #0 by ibuclaw — 2020-07-20T22:39:11Z
Similar to issue 11170, but not a duplicate (GDC triggers an ICE in different locations for both tests). This gives a bad error message. "D main" is *not* a nested function. --- struct map(alias fun) { @property run() { } } struct Task(Args) { Args _args; } template reduce(functions...) { auto reduce(Args)(Args args) { alias RTask = Task!(typeof(args)); auto task = RTask(); } } void main() { immutable delta = 1; reduce!"a + b"(map!({ immutable x = delta; })()); }
Comment #1 by robert.schadek — 2024-12-13T19:10:14Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17972 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB