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

Unable to serialize const classes to Bson #653

Closed
japplegame opened this Issue May 8, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@japplegame
Contributor

japplegame commented May 8, 2014

import vibe.data.bson;

class Foo {
    int a;
    Bson toBson() const { return serializeToBson(["a": a]); }
    static Foo fromBson(Bson bson) { return new Foo; }
}

void main() { 
    const auto foo = new Foo;
    auto bson = serializeToBson(foo);
}
vibe\data\serialization.d(146): Error: function vibe.data.bson.BsonSerializer.writeValue!(Foo).writeValue (Foo value) is not callable using argument types (const(Foo))
@japplegame

This comment has been minimized.

Show comment
Hide comment
@japplegame

japplegame Jun 5, 2014

Contributor

Doesn't compile again. :(

Contributor

japplegame commented Jun 5, 2014

Doesn't compile again. :(

s-ludwig added a commit that referenced this issue Jun 5, 2014

@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Jun 5, 2014

Member

Turns out the unit test for this was flawed (copy/past error). I've fixed both, the test and the code again now. Sorry, that was definitely quite unfortunate. I had to revert the use of auto ref to make things compile on 2.064 and GDC/LDC and trusted the test.

Member

s-ludwig commented Jun 5, 2014

Turns out the unit test for this was flawed (copy/past error). I've fixed both, the test and the code again now. Sorry, that was definitely quite unfortunate. I had to revert the use of auto ref to make things compile on 2.064 and GDC/LDC and trusted the test.

@japplegame

This comment has been minimized.

Show comment
Hide comment
@japplegame

japplegame Jun 5, 2014

Contributor

Thanks.

Contributor

japplegame commented Jun 5, 2014

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment