constructor instead of opCall for an instance of a template alias
Rob T
rob at ucora.com
Sun Nov 25 10:49:33 PST 2012
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. heavily use struct
> ctor, write opCall method and everything breaks due to dmd
> tries now to call opCall instead of ctor.
Looks like something was fixed with 2.061, the sample code now
refuses to compile, which is correct behavior.
void main() {
auto a = A(42);
}
source/main.d(10): Error: need 'this' for opCall type void(int i)
--rt
More information about the Digitalmars-d-learn
mailing list