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

LWG-3561 Issue with internal counter in discard_block_engine #2250

Closed
MattStephanson opened this issue Oct 5, 2021 · 2 comments · Fixed by #4066
Closed

LWG-3561 Issue with internal counter in discard_block_engine #2250

MattStephanson opened this issue Oct 5, 2021 · 2 comments · Fixed by #4066
Labels
fixed Something works now, yay! LWG Library Working Group issue

Comments

@MattStephanson
Copy link
Contributor

MattStephanson commented Oct 5, 2021

LWG-3561 Issue with internal counter in discard_block_engine

Discussion from the meta-issue #2236:

  • @MattStephanson

    LWG-3561: This would involving changing discard_block's internal _Nx counter and template arguments from int to size_t, which I think would be an ABI break. I think the most we could do now is add a // TRANSITION, ABI comment, and maybe a static_assert for discard_block_engine that its parameters must be <= INT_MAX.

  • @CaseyCarter

    I think we could greatly improve discard_block_engine by divorcing it completely from the TR1-era discard_block. We could even make it tolerate p > INT_MAX, but I agree that r > INT_MAX is not supportable without breaking ABI.

  • @timsong-cpp

    Couldn't you change the type of _Nx only if r > INT_MAX?
    Edit: looks like MSVC doesn't check narrowing from size_t to int in the NTTP, hmm...is it an ABI break if the existing thing compiles but totally doesn't work?

@StephanTLavavej StephanTLavavej added the LWG Library Working Group issue label Oct 5, 2021
@MattStephanson
Copy link
Contributor Author

Couldn't you change the type of _Nx only if r > INT_MAX?

That's an interesting idea. I can see how that might work, but it would require not just _Nx but also discard_block's NTTPs to be dependent as well (or unconditionally size_t). I don't know if that has ABI implications..

is it an ABI break if the existing thing compiles but totally doesn't work?

Not necessarily, I think, but existing object files where discard_block is instantiated with negative parameters still have to link, even if their implementation is broken. Presumably the existing objects already contain at least one definition, since it's inline, so maybe it's unnecessary for new code to handle such cases?

@frederick-vs-ja
Copy link
Contributor

Can we change the base class of discard_block_engine when r > INT_MAX?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Something works now, yay! LWG Library Working Group issue
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants