@property with opCall

Calvin P changlon at gmail.com
Mon Mar 9 09:25:31 UTC 2020


Is this a bugs ?

==============
struct A {
         ref auto opCall(string tmp) scope return {
                 return this;
         }
}

struct B {
         A _a;

         @property ref auto a() scope return {
                 return _a;
         }
}

extern(C) int main(){
         A a;
         a("a")("b");
         B b;
         b.a("a")("b");  // Error: function test_opCall.B.a() is 
not callable using argument types (string)
         return 0;
}
==========


I has to use  b.a()("a")("b") to avoid the compiler error. I 
think it should work to avoid the unnecessary ()

Should I submit a bugs ?





More information about the Digitalmars-d-learn mailing list