Bug 11533 – Compiler should allow to being nested for static local template functions
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-17T00:20:56Z
Last change time
2022-11-14T14:10:55Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Kenji Hara
Comments
Comment #0 by k.hara.pg — 2013-11-17T00:20:56Z
Test case:
struct S
{
void put(alias fun)() { fun!int(); }
}
void main()
{
static void foo(T)() {}
S s;
s.put!foo();
static void bar(alias fun)() { fun(); }
void nested() {}
bar!nested();
}
In main, foo and bar are static template function.
- When foo is instantiated in S.put, foo!int should not capture the frame of main function.
- When bar is instantiated in main, it should capture the frame of main function for the alias template parameter `fun`, but bar itself should not capture any frame.
*** Issue 7805 has been marked as a duplicate of this issue. ***
Comment #4 by petar.p.kirov — 2016-03-15T16:32:42Z
I'm reopening because the test case doesn't work with DMD 2.070.2:
/d224/f50.d(11): Error: static function f50.main.bar!(nested).bar cannot access frame of function D main
/d224/f50.d(13): Error: template instance f50.main.bar!(nested) error instantiating
Comment #5 by k.hara.pg — 2016-03-15T23:06:10Z
(In reply to ZombineDev from comment #4)
> I'm reopening because the test case doesn't work with DMD 2.070.2:
>
> /d224/f50.d(11): Error: static function f50.main.bar!(nested).bar cannot
> access frame of function D main
> /d224/f50.d(13): Error: template instance f50.main.bar!(nested) error
> instantiating
Oh, thanks for your reopen. The enhancement change was masked to _fix_ issue 11946.
https://github.com/D-Programming-Language/dmd/pull/3884
Comment #6 by razvan.nitu1305 — 2022-11-14T14:10:55Z
*** This issue has been marked as a duplicate of issue 5710 ***