-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Use UB impl of launder on when using clang < 8 and c++17 #1448
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
@@ -197,7 +197,8 @@ union TypeErasedState { | |||
template <class T> | |||
T& ObjectInLocalStorage(TypeErasedState* const state) { | |||
// We launder here because the storage may be reused with the same type. | |||
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L | |||
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \ |
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.
The proposed patch works in my testing, but I think I more principled thing to do would be to use #if __cpp_lib_launder >= 201606L
. This seems to produce the same result when I try it on godbolt.
libstdc++'s definition of std::launder places it behind a check for __builtin_launder, which is not available before clang 8. Fixes: abseil#1309
…ebrtc-reviewers,ng Sent upstream at abseil/abseil-cpp#1448 Differential Revision: https://phabricator.services.mozilla.com/D178274
…ebrtc-reviewers,ng Sent upstream at abseil/abseil-cpp#1448 Differential Revision: https://phabricator.services.mozilla.com/D178274
…ebrtc-reviewers,ng Sent upstream at abseil/abseil-cpp#1448 Differential Revision: https://phabricator.services.mozilla.com/D178274 Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d976369464663a9147b82c82436afcaab1f61aec
…ebrtc-reviewers,ng Sent upstream at abseil/abseil-cpp#1448 Differential Revision: https://phabricator.services.mozilla.com/D178274 Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d976369464663a9147b82c82436afcaab1f61aec
libstdc++'s definition of std::launder places it behind a check for __builtin_launder, which is not available before clang 8.
Fixes: #1309