[Issue 7554] Immutable function pointer arguments too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 27 15:27:56 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7554



--- Comment #3 from bearophile_hugs at eml.cc 2012-02-27 15:27:55 PST ---
This code compiles, but I don't remember if this used to compile even before
fixing bug 7500 :


int outer(immutable int function(in int) pure foo) pure {
     pure int inner() {
         return foo(5);
     }
     return inner();
}
int sqr(in int x) pure {
     return x * x;
}
void main() {
     assert(outer(&sqr) == 25);
}



This doesn't compile still:

T outer(T)(immutable T function(T) pure foo) pure {
     pure int inner() {
         return foo(5);
     }
     return inner();
}
int sqr(int x) pure {
     return x * x;
}
void main() {
     assert(outer(&sqr) == 25);
}

-- 
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