[Issue 9410] New: Wrong selection for function overload
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jan 27 05:11:24 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9410
Summary: Wrong selection for function overload
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: rswhite4 at googlemail.com
--- Comment #0 from rswhite4 at googlemail.com 2013-01-27 05:11:22 PST ---
This code:
[code]
import std.stdio;
struct Vec2(T) {
public:
T x;
T y;
this(T x, T y) {
}
}
alias Vec2f = Vec2!(float);
class Foo {
public:
static Foo make(float i, ref const Vec2f a) {
return new Foo();
}
static Foo make(float i, const Vec2f a) {
return Foo.make(i, a);
}
}
void main() {
Foo f = Foo.make(42, Vec2f(4, 2));
}
[/code]
prints:
Error: (Vec2!(float) __ctmp1173 = _D4c42511__T4Vec2TfZ4Vec26__initZ;
, __ctmp1173).this(4F, 2F) is not an lvalue
But IMO it should compile.
Also this code:
[code]
import std.stdio;
struct Rect(T) {
private:
T x, y, w, h;
public:
this(T x, T y, T w, T h) {
}
}
alias FloatRect = Rect!(float);
class A { }
class B : A { }
class C {
public:
this(A a, ref const FloatRect sr) {
}
this(A a, const FloatRect sr) {
this(a, sr);
}
}
void main() {
// new C(new A(), FloatRect(0, 1, 2, 3)); // works
new C(new B(), FloatRect(0, 1, 2, 3));
}
[/code]
seems to have the same problem. It prints:
Error: (Rect!(float) __ctmp1173 = _D4c84111__T4RectTfZ4Rect6__initZ;
, __ctmp1173).this(0F, 1F, 2F, 3F) is not an lvalue
--
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