digitalmars.D.learn - opCall override default constructor?
- Jacob Carlborg (17/17) Jun 02 2016 Is it intentional that a non-static opCall overrides the default
- Era Scarecrow (3/8) Jun 02 2016 It sounds like a bug, since the object isn't instantiated yet it
- Marc =?UTF-8?B?U2Now7x0eg==?= (3/18) Jun 02 2016 It's this bug:
- Jacob Carlborg (4/6) Jun 02 2016 Ok, thanks.
Is it intentional that a non-static opCall overrides the default constructor of a struct? struct Foo { int a; void opCall(string b) { } } void main() { auto f = Foo(3); // line 14 f("asd"); } The above code gives the following error: main.d(14): Error: function main.Foo.opCall (string b) is not callable using argument types (int) -- /Jacob Carlborg
Jun 02 2016
On Thursday, 2 June 2016 at 08:50:26 UTC, Jacob Carlborg wrote:Is it intentional that a non-static opCall overrides the default constructor of a struct? auto f = Foo(3); // line 14 main.d(14): Error: function main.Foo.opCall (string b) is not callable using argument types (int)It sounds like a bug, since the object isn't instantiated yet it shouldn't be able to call opCall yet...
Jun 02 2016
On Thursday, 2 June 2016 at 08:50:26 UTC, Jacob Carlborg wrote:Is it intentional that a non-static opCall overrides the default constructor of a struct? struct Foo { int a; void opCall(string b) { } } void main() { auto f = Foo(3); // line 14 f("asd"); } The above code gives the following error: main.d(14): Error: function main.Foo.opCall (string b) is not callable using argument types (int)It's this bug: https://issues.dlang.org/show_bug.cgi?id=9078
Jun 02 2016
On 2016-06-02 12:16, Marc Schütz wrote:It's this bug: https://issues.dlang.org/show_bug.cgi?id=9078Ok, thanks. -- /Jacob Carlborg
Jun 02 2016