-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
<random>
: Implement LWG-3519
#2208
Conversation
For posterity: VSO-568006 is an EDG bug "Attributes are not accepted on friend definitions inside class templates" template <class T>
struct S {
[[xyz]] friend int f() { return 0; }
}; with EDG incorrectly diagnoses:
This result is independent of the choice of attribute ( This bug has been fixed in the EDG frontend that powers IntelliSense (for which the STL has test coverage via |
Thanks! As #2088 is smaller and has been waiting for review for almost 2 months, I went ahead and reviewed it, pushed changes, and moved it to Final Review. I'd like to merge it first, and then resolve the conflict in your larger PR. |
I went to resolve the merge conflict and found that this PR merges cleanly with |
Thanks for checking - I don't think we need an additional test run with the latest state of |
I saw that DevCom-1555597 was reported, which appears to involve unguarded occurrences of Line 263 in d8f03cf
We might want to convert all existing usage to _NODISCARD_FRIEND in this PR, if that isn't too much of a distraction (however, handling it separately would also be fine).
|
I think that should be a separate PR to avoid swamping this PR's functional change with an ocean of mechanical replacement. (Yes, "swamping with an ocean" - I'll mix all the metaphors I like!) |
I was on the fence, but if @CaseyCarter prefers a separate PR then let's do it that way. |
Looks great! 😻 I pushed a trivial style change and a merge with I saw the minor refactorings you applied (e.g. lifting out a repeated call to |
@StephanTLavavej Thanks! While I have your attention, would you mind clarifying an ABI point? I pointed out in item (4) of my first comment that I removed the |
Yep, that sounds right to me! In general, changes to header-only functions are ABI-safe unless they do things like:
In such cases, renaming the functions (and renaming affected internal classes, in the "changed object state" scenario) restores safety, since that transforms mix-and-match scenarios from the bad case of "old code links to new, incompatible code" to the good case of "old code has Your moved functionality is equivalent to remove-and-add so it's safe. 😸 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll go ahead and apply my single suggestion.
@CaseyCarter I pushed a commit to fix test failures - |
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Ouch, mea culpa. ( |
Thanks for implementing this major LWG issue resolution and improving our workaround for CUDA here! 😻 🛠️ 🚀 |
Fixes #2179.
Notes:
[[nodiscard]]
and hidden friends), since it comes up much more now. I'm open to a better name, though, maybe_NODISCARD_HIDDEN_FRIEND
.subtract_with_carry_engine
, even though<random>
: Fixes subtract_with_carry_engine io #2088 does too. I'll work with the author of that PR on a patch to resolve the merge conflict._Write
or_Read
, so I took the liberty of inlining those.piecewise_meow_distribution
were a bit subtle because of (IMO) a design mistake. They contain twodiscrete_distribution<size_t>::param_type
subobjects, one from the base class and another from their ownparam_type
base classes. As far as I can tell, only the latter is used, so I've tried to make this more clear. (E.g., previouslydiscrete_distribution::_Meow
was a non-static member function that actually meowed itsparam_type
argument. Now it's a member ofparam_type
that meows the object it's called on.)