Weird UFC and opCall issues

Jay Pinkman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Dec 17 18:42:30 PST 2014


void main () {
     struct X {
         string x;

         void opCall (string y) {
             import std.stdio;
             writeln("%s %s!", x, y);
         }
     }

     auto x = X("hello");
     "world".x;
}

source/main.d(12): Error: need 'this' for 'opCall' of type 
'void(string y)'
source/main.d(13): Error: no property 'x' for type 'string'

but why?


More information about the Digitalmars-d-learn mailing list