[libcxx-commits] [libcxx] 418de7d - Fix UB in one libcxx test, when deleting D through a pointer to B.
Arthur O'Dwyer via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 4 14:34:50 PST 2020
Author: Arthur O'Dwyer
Date: 2020-11-04T17:34:05-05:00
New Revision: 418de7d5d84aa95a644139f87319269841a44315
URL: https://github.com/llvm/llvm-project/commit/418de7d5d84aa95a644139f87319269841a44315
DIFF: https://github.com/llvm/llvm-project/commit/418de7d5d84aa95a644139f87319269841a44315.diff
LOG: Fix UB in one libcxx test, when deleting D through a pointer to B.
This undefined behavior was found by applying Lénárd Szolnoki's proposal
to disable implicit conversion of default_delete<D> to default_delete<B>.
The offending part of the test is circa line 243.
The wording that makes it undefined behavior is http://eel.is/c++draft/expr.delete#3 .
Differential Revision: https://reviews.llvm.org/D90536
Added:
Modified:
libcxx/test/std/utilities/optional/optional.object/optional.object.assign/optional_U.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/optional_U.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/optional_U.pass.cpp
index 0ad318339563..eb0e83fb0efb 100644
--- a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/optional_U.pass.cpp
+++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/optional_U.pass.cpp
@@ -51,7 +51,7 @@ struct Y2
Y2& operator=(const int&) { return *this; }
};
-class B {};
+struct B { virtual ~B() = default; };
class D : public B {};
More information about the libcxx-commits
mailing list