mirror of
https://github.com/AntelopeIO/cdt-libcxx.git
synced 2026-07-21 13:53:36 +00:00
Harden variant test added in r366022
The test was brittle since it only went boom for one specific type, when really it should go boom for all of them. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@366025 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -177,13 +177,13 @@ void test_T_ctor_basic() {
|
||||
#endif
|
||||
}
|
||||
|
||||
struct BoomOnInt {
|
||||
struct BoomOnAnything {
|
||||
template <class T>
|
||||
constexpr BoomOnInt(T) { static_assert(!std::is_same<T, int>::value, ""); }
|
||||
constexpr BoomOnAnything(T) { static_assert(!std::is_same<T, T>::value, ""); }
|
||||
};
|
||||
|
||||
void test_no_narrowing_check_for_class_types() {
|
||||
using V = std::variant<int, BoomOnInt>;
|
||||
using V = std::variant<int, BoomOnAnything>;
|
||||
V v(42);
|
||||
assert(v.index() == 0);
|
||||
assert(std::get<0>(v) == 42);
|
||||
|
||||
Reference in New Issue
Block a user