[Issue 4253] New: opCall() not called in initialized struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun May 30 09:27:09 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4253
Summary: opCall() not called in initialized struct
Product: D
Version: future
Platform: x86
OS/Version: Windows
Status: NEW
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 2010-05-30 09:27:07 PDT ---
This is a small C++ program that compiles:
template<typename T> struct Foo {
Foo(T x) {}
template<typename U> void operator()(U y) {}
};
int main() {
Foo<int> foo(1);
foo(1.5);
}
I think this is an equivalent D2 program:
struct Foo(T) {
this(T x) {}
void opCall(U)(U y) {}
}
void main() {
auto foo = Foo!int(1);
foo(1.5); // line 7
}
But DMD V. 2.046 prints:
temp.d(7): Error: constructor temp.Foo!(int).Foo.this (int x) is not callable
using argument types (double)
temp.d(7): Error: cannot implicitly convert expression (1.5) of type double to
int
--
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