Skip to content

Fixing non-reference base_t::reference case with replaced_if adaptor #108

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

m-karcz
Copy link

@m-karcz m-karcz commented Aug 1, 2020

replaced_if is just transformed with conditional replacing functor.

If base iterator returns value instead reference, conditional functor returns dangling reference to that value which ends with undefined behaviour.
This pull request fix that by forwarding this value or returning copy of held one.

Ex. on gcc-7 added test had {0,0,7,32767} as result range instead of {3,2,7,0}. After this change it returns valid range.

@m-karcz m-karcz marked this pull request as draft August 2, 2020 10:12
@m-karcz m-karcz force-pushed the develop branch 2 times, most recently from 7d2648a to 59fb6c6 Compare August 2, 2020 11:22
@m-karcz m-karcz marked this pull request as ready for review August 2, 2020 11:30
@m-karcz
Copy link
Author

m-karcz commented Aug 3, 2020

I don't know why regression fails on apple, same issue happened on PR#107.

My PR doesn't touch transformed, just replaced_if, but ticket_6742_transformed_c4789_warning fails. Looks like some boost.phoenix breaking change.

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

Successfully merging this pull request may close these issues.

1 participant