Skip to content

ostream recursive loop in find_noncopyable_vars #71

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

Closed
dermont123 opened this issue Feb 26, 2017 · 5 comments
Closed

ostream recursive loop in find_noncopyable_vars #71

dermont123 opened this issue Feb 26, 2017 · 5 comments
Labels
Milestone

Comments

@dermont123
Copy link

Hi,
I found the problem I had with the recursive loop in find_noncopyable_vars. It appears to happen for a class with a stream variable(std::istream*) and when base classes are known for ostream in class_declaration.hierarchy_info_t in is_noncopyable().

I think ::std::basic_ostream processes it base class std::basic_ios which holds a pointer to ostream and so on.

Stream.zip

iMichka added a commit that referenced this issue Feb 26, 2017
The test is not run by the test suite for the moment.
@iMichka iMichka added the bug label Feb 26, 2017
@iMichka iMichka added this to the 1.8.6 milestone Feb 26, 2017
@iMichka
Copy link
Collaborator

iMichka commented Feb 26, 2017

Thanks. I added a small test to the hot fix/v1.8.6 branch, which reproduces the problem, based on your code. I will investigate this.

iMichka added a commit that referenced this issue Feb 27, 2017
These tests are still disabled as they are is still failing, but they now
clearly show the problem.
@iMichka
Copy link
Collaborator

iMichka commented Feb 27, 2017

I am making good progress. Took me some time, but I was able to write a simplified test that shows an equivalent problem.

The situation in too sstream complicated. I do not know the internals of that code, there are a lot of declarations in there, so it is difficult to debug.

In fact, it is quite easy to end up in that the infinite recursion state with a hierarchy of 3 classes, and some pointers holding references to one of the other classes.

I will work on a fix now. I probably just need to keep a list of the classes that have already been visited, and prevent them to be visited again. I'll work on this tomorrow though, writing the test and debugging the code already took me forever. But it is an interesting problem. Weird nobody ever stumbled over this before, because it is not an unlikely scenario.

iMichka added a commit that referenced this issue Feb 28, 2017
To fix this bug, a list of already parsed variables is
passed trhough the different methods. This is optional.
In general, if you call is_noncopyable, you do not
need to provide the list
@iMichka
Copy link
Collaborator

iMichka commented Feb 28, 2017

I pushed a fix to the hotfix/v1.8.6 branch. Could you test this please?

@dermont123
Copy link
Author

Thanks, it fixed the recursion issue for me.

@iMichka
Copy link
Collaborator

iMichka commented Mar 2, 2017

Cool. I will publish the 1.8.6 release with the fix during the weekend.

@iMichka iMichka closed this as completed Mar 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants