[Issue 18289] New: static function and access frame

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 23 23:34:22 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18289

          Issue ID: 18289
           Summary: static function and access frame
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: sascha.orlov at gmail.com

According to the discussion here: 
https://forum.dlang.org/thread/qknxjxzbaowmsjdngvli@forum.dlang.org
the following code should compile, but it does not. 

void main() // line 1
{
    auto s = S();
    auto t = T!s(); // line 4
    t.fun;
}
struct S { void fun(){} }
struct T(alias s){ static fun() { s.fun; } } // line 8

The error is: 
source/app.d(8,35): Error: static function app.main.T!(s).T.fun cannot access
frame of function D main
source/app.d(4,14): Error: template instance app.main.T!(s) error instantiating

--


More information about the Digitalmars-d-bugs mailing list