http://d.puremagic.com/issues/show_bug.cgi?id=9027
Summary: Getting address of overloaded function using `cast`
selects the lexically first one if there is no match
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: accepts-invalid, wrong-code
Severity: major
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Denis Shelomovskij <[email protected]> 2012-11-15
11:43:12 MSK ---
---
void f1() { }
void f1(int) { }
extern(C) void f1(int) { }
void f2() { }
extern(C) void f2(int) { }
extern(C) void f3(int) { }
void f3() { }
extern(Windows) void f4(long) { }
extern(C) void f4(long) { }
void main()
{
// ok, `void f1(int)` selected
static assert( __traits(compiles, cast(void function(int)) &f1));
// fails, `void f2()` selected
static assert(!__traits(compiles, cast(void function(int)) &f2));
// fails, `extern(C) void f3(int)` selected
static assert(!__traits(compiles, cast(void function(int)) &f3));
// fails, `extern(Windows) void f4(long) { }` selected
static assert(!__traits(compiles, cast(void function()) &f4));
}
---
Probably related to Issue 7549 but this issue is fatal as it leads to all kinds
of stack and memory corruption.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------