[Issue 7955] New: Nested function error in sort with lambda template but not with a lambda
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 20 17:51:08 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7955
Summary: Nested function error in sort with lambda template but
not with a lambda
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2012-04-20 17:52:05 PDT ---
import std.algorithm: sort;
int foo(int n)() {
sort!((a, b) => true)([1]);
//sort!((int a, int b) => true)([1]);
foo!1();
return 0;
}
void main() {
foo!0();
}
DMD 2.059 shows:
...\dmd2\src\phobos\std\algorithm.d(6781): Error: function
test.foo!(0).foo.sort!(__lambda3,cast(SwapStrategy)0,int[]).sort is a nested
function and cannot be accessed from test.foo!(1).foo
The version that uses the lambda instead of a lambda template compiles
correctly (then crashes at a runtime because the sort function is stupid).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list