Skip to content
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

ADL deserializer not picked up for non default-constructible type #1072

Closed
SylvainCorlay opened this issue May 1, 2018 · 2 comments
Closed

Comments

@SylvainCorlay
Copy link

SylvainCorlay commented May 1, 2018

Bug Report

  • What is the issue you have?

I am seeing a situation where

v = j;

picks up the default deserializer, which yields in my case

Standard Exception: [json.exception.type_error.302] type must be number, but is array

while an unqualified call to from_Json like

from_json(j, v);

results in the right overload being picked up through ADL.

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?

This came up in the xtensor PR xtensor-stack/xtensor#830 in which I joined an example notebook:

https://github.com/SylvainCorlay/xtensor/blob/d4a67ac488fc10a99b7238d9314a9970f5562c34/notebooks/json.ipynb

screen shot 2018-05-01 at 8 18 39 pm

Clang (through cling) for the example, but I see the same thing in gcc.

  • Did you use a released version of the library or the version from the develop branch?

no

no compilation error

@SylvainCorlay
Copy link
Author

Note that the same thing works for other xt:: types that are default-constructible (like containers) while it fails for xview, which are not default-constructible.

@SylvainCorlay
Copy link
Author

SylvainCorlay commented May 1, 2018

Hum, I guess that this would probably require xt::xview to have an operator= taking the JSON object as an rhs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant