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

SDR should not auto-cast if vector provided instead of SDR as argument #416

Open
breznak opened this issue Apr 17, 2019 · 3 comments
Open
Labels
bug Something isn't working sdr

Comments

@breznak
Copy link
Member

breznak commented Apr 17, 2019

@ctrl-z-9000-times You've mentioned the bug, and I ran into it in #397 with cellsToColumns

Problem: compiler(?) converts a wrongly-passed type vector to a SDR if SDR is a method's argument.

Example:

void bla(const SDR& input);

SDR ok;
vector<UInt> shouldFail;

bla(ok); //ok
bla(shouldFail); // should fail, as incompatible type provided, but instead this gets converted to a new SDR, which is totally wrong, as uses the data, instead of dimensions. 

Hint: I'd suspect some of SDR's default constructors, or assign operators

@breznak breznak added bug Something isn't working sdr labels Apr 17, 2019
@breznak
Copy link
Member Author

breznak commented Apr 17, 2019

see 127e385

@ctrl-z-9000-times
Copy link
Collaborator

I don't think we're going to be able to stop the compiler from doing this.

We can detect this issue by checking the SDR's dimensions. Regardless of this bug, we should check SDR dimensions on most public facing API methods.

@breznak
Copy link
Member Author

breznak commented Apr 17, 2019

We can detect this issue by checking the SDR's dimensions. Regardless of this bug, we should check SDR dimensions on most public facing API methods.

would be nice if we could stop that behavior, if not, this should be documented somewhere (in SDR?) along with the advice to check SDR.dimensions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sdr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants