You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following code if I define const foo, the code compiles:
import std.algorithm: map;
void main() {
//const foo = (int x) => x; // OK
enum foo = (int x) => x; // error
[1].map!foo;
}
If I use enum foo I receive the error messages, dmd 2.064alpha:
...\dmd2\src\phobos\std\algorithm.d(410): Error: function std.algorithm.MapResult!(int(int x)
{
return x;
}
, int[]).MapResult.back cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(444): Error: function std.algorithm.MapResult!(int(int x)
{
return x;
}
, int[]).MapResult.front cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(456): Error: function std.algorithm.MapResult!(int(int x)
{
return x;
}
, int[]).MapResult.opIndex cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(396): Error: template instance std.algorithm.MapResult!(int(int x)
{
return x;
}
, int[]) error instantiating
bug.d(5): instantiated from here: map!(int[])
bug.d(5): Error: template instance std.algorithm.map!(int(int x)
{
return x;
}
).map!(int[]) error instantiating
I think a better formatting for those error messages could be:
...\dmd2\src\phobos\std\algorithm.d(410): Error: function std.algorithm.MapResult!(int(int x) { return x; }, int[]).MapResult.back cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(444): Error: function std.algorithm.MapResult!(int(int x) { return x; }, int[]).MapResult.front cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(456): Error: function std.algorithm.MapResult!(int(int x) { return x; }, int[]).MapResult.opIndex cannot access frame of function D main
...\dmd2\src\phobos\std\algorithm.d(396): Error: template instance std.algorithm.MapResult!(int(int x) { return x; }, int[]) error instantiating
bug.d(5): instantiated from here: map!(int[])
bug.d(5): Error: template instance std.algorithm.map!(int(int x) { return x; }).map!(int[]) error instantiating
The text was updated successfully, but these errors were encountered:
bearophile_hugs reported this on 2013-08-17T14:16:42Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=10839
Description
In the following code if I define const foo, the code compiles: import std.algorithm: map; void main() { //const foo = (int x) => x; // OK enum foo = (int x) => x; // error [1].map!foo; } If I use enum foo I receive the error messages, dmd 2.064alpha: ...\dmd2\src\phobos\std\algorithm.d(410): Error: function std.algorithm.MapResult!(int(int x) { return x; } , int[]).MapResult.back cannot access frame of function D main ...\dmd2\src\phobos\std\algorithm.d(444): Error: function std.algorithm.MapResult!(int(int x) { return x; } , int[]).MapResult.front cannot access frame of function D main ...\dmd2\src\phobos\std\algorithm.d(456): Error: function std.algorithm.MapResult!(int(int x) { return x; } , int[]).MapResult.opIndex cannot access frame of function D main ...\dmd2\src\phobos\std\algorithm.d(396): Error: template instance std.algorithm.MapResult!(int(int x) { return x; } , int[]) error instantiating bug.d(5): instantiated from here: map!(int[]) bug.d(5): Error: template instance std.algorithm.map!(int(int x) { return x; } ).map!(int[]) error instantiating I think a better formatting for those error messages could be: ...\dmd2\src\phobos\std\algorithm.d(410): Error: function std.algorithm.MapResult!(int(int x) { return x; }, int[]).MapResult.back cannot access frame of function D main ...\dmd2\src\phobos\std\algorithm.d(444): Error: function std.algorithm.MapResult!(int(int x) { return x; }, int[]).MapResult.front cannot access frame of function D main ...\dmd2\src\phobos\std\algorithm.d(456): Error: function std.algorithm.MapResult!(int(int x) { return x; }, int[]).MapResult.opIndex cannot access frame of function D main ...\dmd2\src\phobos\std\algorithm.d(396): Error: template instance std.algorithm.MapResult!(int(int x) { return x; }, int[]) error instantiating bug.d(5): instantiated from here: map!(int[]) bug.d(5): Error: template instance std.algorithm.map!(int(int x) { return x; }).map!(int[]) error instantiatingThe text was updated successfully, but these errors were encountered: