[Issue 17063] Nested function template cannot be accessed
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 15 04:14:18 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=17063
Steven Schveighoffer <schveiguy at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |schveiguy at gmail.com
--- Comment #1 from Steven Schveighoffer <schveiguy at gmail.com> ---
Found another interesting case of this:
```
void main()
{
int x = 5;
bool foo(T)(T arg)
{
return arg == x;
}
import std.functional;
unaryFun!foo(5); // ok!
testit!foo(5); // error
}
auto testit(alias pred, T)(T arg)
{
import std.functional;
return unaryFun!pred(arg);
}
```
Note that instantiating unaryFun!foo directly in the function works, but
outside the function it doesn't. I can't see why it's different.
Changing foo to:
```
bool foo(int arg)
```
Works in both cases. Clearly the frame is accessible.
--
More information about the Digitalmars-d-bugs
mailing list