Bug 7618 – delegate/function pointer call bypass parameter storage class
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-01T03:51:00Z
Last change time
2012-03-02T12:39:40Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2012-03-01T03:51:02Z
Test case:
----
void foo(const int x)
{
int func(ref int) { return 1; }
func(x);
// Error: function test.foo.func (ref int x) is not callable
// using argument types (const(int))
/ --> OK
int delegate(ref int) dg = (ref int x) => 1;
dg(x);
// --> compiles without error, bad!
int function(ref int) fp = (ref int x) => 1;
fp(x);
// --> compiles without error, bad!
}