-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't know how to construct class type 'S' with argument types '()' #54
Comments
|
You mean Unpacker? Line 2649 in b068112
Could you show me your code example? |
|
Yes, Unpacker. class A{ void test(){ T allocClass(T, Args...) (Args args) { // instead of 0-fill, would fill up the buffer from deserialization GC.addRange(memory.ptr, size); |
|
Started a thread here: http://forum.dlang.org/thread/mailman.105.1432199217.7663.digitalmars-d-learn@puremagic.com [deserialization: creating a class instance without calling constructor] Some proposed: CT construct(CT, A...)(A a) if (is(CT == class)){ Although I think he meant this: CT construct(CT)() if (is(CT == class)){ |
|
I know we can use manual construction without new for classes.
This means I want to know what the code causes class A
{
this(int a) { }
}
A a;
unpacker.unpack(a, 10); // ok
unpacker.unpack(a); // errorLatter case is error prone but it seems acceptable. I will support it. |
|
Thanks, the patch works for DMD, however see my comments in the PR; it may not work for LDC compiler. |
Seems like msgpack-d requires empty constructor for classes.
Can we relax this?
Classes could be allocated without calling 'new' constructor to enable this.
The text was updated successfully, but these errors were encountered: