Small opCall problem

BCS none at anon.com
Sun May 30 09:20:59 PDT 2010


Hello bearophile,

> struct Foo(T) {
> this(T x) {}
> void opCall(U)(U y) {}
> }
> void main() {
> auto foo = Foo!int(1);
> foo(1.5);
> }

FWIW, The struct being a template is extraneous.

> temp.d(7): Error: constructor temp.Foo!(int).Foo.this (int x) is not callable 
using argument types (double)

The lookup seems to think you are calling the constructor. Should make it 
easy to find the bug. (And yes, I think this is a bug)

-- 
... <IXOYE><





More information about the Digitalmars-d-learn mailing list