www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17063] New: Nested function template cannot be accessed


          Issue ID: 17063
           Summary: Nested function template cannot be accessed
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: jens.mueller sociomantic.com

The following code does not compile with dmd v2.072.2. It gives

test.d(3): Error: function test.__unittestL6_1.bar!cast(ubyte)0u.bar is a
nested function and cannot be accessed from test.foo!(bar).foo

void foo(alias fun)()

    // needs to be a template to cause the compilation to fail
    void bar(ubyte a = 0)()

    // workaround
    alias blub = bar!0;


The problem seems to be the function template. When the function template is
explicitly initialized it works.

Jan 06 2017