Re: constructor instead of opCall for an instance of a template alias

2012-11-25 Thread Rob T
On Sunday, 25 November 2012 at 16:42:03 UTC, Maxim Fomin wrote: Recently I saw a major pull affecting this behavior, so in 2.061 the situation may be changed (I haven't bother to figure yet). In practice this makes a tricky thing to understand what S() is and creates a problem when you e.x. hea

Re: constructor instead of opCall for an instance of a template alias

2012-11-25 Thread comco
On Sunday, 25 November 2012 at 16:01:39 UTC, Ali Çehreli wrote: Could you please create a bug report: http://d.puremagic.com/issues/ Ali Filed an issue 9078.

Re: constructor instead of opCall for an instance of a template alias

2012-11-25 Thread Maxim Fomin
On Sunday, 25 November 2012 at 15:27:53 UTC, comco wrote: A!B(...) defines a struct A with B typed in as Method, so call to method(s); is the same as B(string) Why is that? Here method is an instance of the type Method, not the type Method itself, so by saying `method(s)` we can't mean a cons

Re: constructor instead of opCall for an instance of a template alias

2012-11-25 Thread Ali Çehreli
On 11/25/2012 07:27 AM, comco wrote: > >> A!B(...) defines a struct A with B typed in as Method, so call to >> method(s); is the same as B(string) > Why is that? Here method is an instance of the type Method, not the type > Method itself, That could be case but you original code did use a type na

Re: constructor instead of opCall for an instance of a template alias

2012-11-25 Thread comco
A!B(...) defines a struct A with B typed in as Method, so call to method(s); is the same as B(string) Why is that? Here method is an instance of the type Method, not the type Method itself, so by saying `method(s)` we can't mean a constructor. Something very strange happens... I have a simple

Re: constructor instead of opCall for an instance of a template alias

2012-11-24 Thread Rob T
On Saturday, 24 November 2012 at 20:34:39 UTC, comco wrote: I have the following snippet: struct A(alias Method) { string s; this(Method method) { method(s); // 5 } } struct B { this(int i) { } void opCall(string s) { } } void main() { A!B(B(0)); } This code

constructor instead of opCall for an instance of a template alias

2012-11-24 Thread comco
I have the following snippet: struct A(alias Method) { string s; this(Method method) { method(s); // 5 } } struct B { this(int i) { } void opCall(string s) { } } void main() { A!B(B(0)); } This code fails to compile with the following errors: test.d(5): Error: