[Issue 17063] New: Nested function template cannot be accessed
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jan 6 03:22:44 PST 2017
https://issues.dlang.org/show_bug.cgi?id=17063
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 at puremagic.com
Reporter: jens.mueller at 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)()
{
fun();
}
unittest
{
// needs to be a template to cause the compilation to fail
void bar(ubyte a = 0)()
{
}
// workaround
alias blub = bar!0;
foo!blub();
foo!bar();
}
The problem seems to be the function template. When the function template is
explicitly initialized it works.
--
More information about the Digitalmars-d-bugs
mailing list