Avoid new warning C5267 for deprecated implicit copy ctor/assign#3497
Merged
StephanTLavavej merged 2 commits intomicrosoft:mainfrom Feb 26, 2023
Merged
Avoid new warning C5267 for deprecated implicit copy ctor/assign#3497StephanTLavavej merged 2 commits intomicrosoft:mainfrom
StephanTLavavej merged 2 commits intomicrosoft:mainfrom
Conversation
CaseyCarter
suggested changes
Feb 24, 2023
Contributor
CaseyCarter
left a comment
There was a problem hiding this comment.
FWIW, I've submitted https://reviews.llvm.org/D144694 to mirror changes to portions of the any and optional tests that come from libc++. (Including my suggestions.)
CaseyCarter
approved these changes
Feb 24, 2023
Member
Author
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@JonCavesMSFT just implemented a new off-by-default warning for VS 2022 17.7 Preview 1 (internal MSVC-PR-452406) that some internal teams are very interested in using. This warns about the deprecated case in WG21-N4928 [class.copy.ctor]/6 (emphasis mine):
and [class.copy.assign]/2 (emphasis mine):
The warning (which uses the same number for copy ctors and copy assigns) looks like:
We can't enable the warning until 17.7 Preview 1 ships, but we can clean up the product and test code now. (When we enable the warning, the proper places to do so will likely be
tests/std/tests/prefix.lstandtests/tr1/prefix.lst, unlesslibcxxreceives numerous cleanups, in which casetests/universal_prefix.lstwill be the place.)I have filed VSO-1753270 "
/clrC++20alignaswith defaulted SMFs emits fatal error C1193: an error expected in ...\yyaction.cpp(2976) not reached", which prevents one type from being cleaned up here (aligned_typeinP0220R1_any).Notes
bitsettuple<>The Wise?). However, this should be ABI-safe because the copy ctor is being defaulted and therefore remains trivial._CONSTEXPR23to match the WP. (It is implicitlynoexcept.)reference::flipto match the WP's order.P0220R1_anycount, to keep it balanced with the destructor. They must be markednoexceptso that these types remain eligible forany's Small Object Optimization:STL/stl/inc/any
Lines 51 to 53 in 86acfb1
P0220R1_optionalXalso needs a defaulted default ctor (otherwise the defaulted copy ctor will suppress it).P0608R3_improved_variant_converting_constructorconvertible_booldidn't need a defaulted destructor at all, so I have simply dropped it.P0674R1_make_shared_for_arraysWeirdDeleterneeds a defaulted default ctor.P0784R7_library_support_for_more_constexpr_containersconstexprandnoexceptfor local consistency, although I could be persuaded otherwise.P0896R4_views_joinnon_trivially_destructible_input_iteratordidn't have any way to construct a fresh object (it intentionally deletes its default ctor below). I've seen compilers warn about that, so it seems prudent to introduce a hypothetical ctor, which I've commented.