-
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
static_assert
that container and allocator type parameters are object types
#2436
Conversation
…e() &&` invalidates outer iterators Fixes microsoft#2401
…nd allocator Fixes microsoft#2408. This PR implements a message (or more, depending on structure) when you try to instantiate an object which has inherent contradicting type requirements (ex. "pointer to reference"). I tried not to be pedantic with the implementation, but I might've went wrong with that, thus I'm sorry if I did. Notes: I have noticed different order for implementing static asserts in containers, sometimes it's before required types and right after, if there is, friend classes, and sometimes, it's after required types and in different access modifiers (not like it changes anything, just a nitpick).
10235a4
to
5cb35b1
Compare
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.
Just one question:
static_assert
that container and allocator type parameters are not reference types
Should we just |
Yeah, that's a good idea, modulo I'll review and revise this PR that we've neglected for far too long (sorry! 🙀). Updated title accordingly (yes, the title glosses over |
* Changed `unordered_multimap` which was originally overlooked * Varied the wording for container adaptors * For `map`, `multimap`, `unordered_map`, and `unordered_multimap`, checked both the keys and values * Added `!is_function_v<_Ty>` to `allocator` * Changed the checks outside `allocator` to `is_object_v<_Ty>` with matching messages
static_assert
that container and allocator type parameters are not reference typesstatic_assert
that container and allocator type parameters are object types
Pushed:
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for improving these diagnostics - and my apologies again for taking over a year to merge this! 🐌 🦥 🐢 |
Fixes #2408.
This PR implements a message (or more, depending on structure) when you try to instantiate an object which has inherent contradicting type requirements (ex. "pointer to reference").
I tried not to be pedantic with the implementation, but I might've went wrong with that, thus I'm sorry if I did.
Notes: I have noticed different order for implementing static asserts in containers, sometimes it's before required types and right after, if there is, friend classes, and sometimes, it's after required types and in different access modifiers (not like it changes anything, just a nitpick).