You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libcxx/test/support
Eric Fiselier 6f5ab14489 Add option to disable variant narrowing conversion changes.
The paper P0608R3 - "A sane variant converting constructor" disallows
narrowing conversions in variant. It was meant to address this
surprising problem:

  std::variant<std::string, bool> v = "abc";
  assert(v.index() == 1); // constructs a bool.

However, it also disables every potentially narrowing conversion. For
example:

  variant<unsigned> v = 0; // ill-formed
  variant<string, double> v2 = 42; // ill-formed (int -> double narrows)

These latter changes break code. A lot of code. Within Google it broke
on the order of a hundred thousand target with thousands of root causes
responsible for the breakages.

Of the breakages related to the narrowing restrictions, none of them
exposed outstanding bugs. However, the breakages caused by boolean
conversions (~13 root causes), all but one of them were bugs.

For this reasons, I am adding a flag to disable the narrowing conversion
changes but not the boolean conversions one.

One purpose of this flag is to allow users to opt-out of breaking changes
in variant until the offending code can be cleaned up. For non-trivial
variant usages the amount of cleanup may be significant.

This flag is also required to support automated tooling, such as
clang-tidy, that can automatically fix code broken by this change.
In order for clang-tidy to know the correct alternative to construct,
it must know what alternative was being constructed previously, which
means running it over the old version of std::variant.

Because this change breaks so much code, I will be implementing the
aforementioned clang-tidy check in the very near future.

Additionally I'm plan present this new information to the committee so they can
re-consider if this is a breaking change we want to make.

I think libc++ should very seriously consider pulling this change
before the 9.0 release branch is cut. But that's a separate discussion
that I will start on the lists.

For now this is the minimal first step.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@365960 91177308-0d34-0410-b5e6-96231b3b80d8
6 years ago
..
test.support Add include for 'test_macros.h' to all the tests that were missing them. Thanks to Zoe for the (big, but simple) patch. NFC intended. 7 years ago
test.workarounds Add include for 'test_macros.h' to all the tests that were missing them. Thanks to Zoe for the (big, but simple) patch. NFC intended. 7 years ago
Counter.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
DefaultOnly.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
MoveOnly.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
allocators.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
any_helpers.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
archetypes.hpp [pair] Mark constructors as conditionally noexcept 7 years ago
archetypes.ipp [pair] Mark constructors as conditionally noexcept 7 years ago
asan_testing.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
assert_checkpoint.h Add checkpoint diagnostics to help diagnose buildbot failures. 9 years ago
charconv_test_helpers.h Make to_chars/from_chars work back to C++11. This means that we can use them to implement to_string as well. Reviewed as https://reviews.llvm.org/D59598. 7 years ago
cmpxchg_loop.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
constexpr_char_traits.hpp Update the file headers across all of the LLVM projects in the monorepo 7 years ago
container_debug_tests.hpp Remove unused try catch blocks from old debug tests 7 years ago
container_test_types.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
controlled_allocators.hpp Update more file headers across all of the LLVM projects in the monorepo 7 years ago
coroutine_types.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
count_new.hpp Update more file headers across all of the LLVM projects in the monorepo 7 years ago
counting_predicates.hpp Update more file headers across all of the LLVM projects in the monorepo 7 years ago
debug_mode_helper.h Fix test failures after debug mode changes 7 years ago
deleter_types.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
demangle.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
disable_missing_braces_warning.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
emplace_constructible.h fix shadowing warnings in new tests, try 2 8 years ago
experimental_any_helpers.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
external_threads.cpp Update more file headers across all of the LLVM projects in the monorepo 7 years ago
filesystem_dynamic_test_helper.py [test] [support] Use socket()+bind() to create unix sockets portably 7 years ago
filesystem_include.hpp Implement <filesystem> 7 years ago
filesystem_test_helper.hpp Add large file support to create_file for 32-bit. 7 years ago
format_string.hpp Fix missing includes in format_string.hpp helper 7 years ago
fp_compare.h Implement midpoint for floating point types. Reviewed as https://reviews.llvm.org/D61014. 7 years ago
hexfloat.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
is_transparent.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
min_allocator.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
msvc_stdlib_force_include.hpp [libc++] [test] Silence C++20 deprecation warnings in the MSVC STL 7 years ago
nasty_containers.hpp Update more file headers across all of the LLVM projects in the monorepo 7 years ago
nasty_macros.hpp Avoid name conflict with kernel headers 7 years ago
nothing_to_do.pass.cpp Support tests in freestanding 7 years ago
platform_support.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
poisoned_hash_helper.hpp Update more file headers across all of the LLVM projects in the monorepo 7 years ago
private_constructor.hpp Update more file headers across all of the LLVM projects in the monorepo 7 years ago
propagate_const_helpers.h Implement std::experimental::propagate_const from LFTS v2 10 years ago
rapid-cxx-test.hpp Implement a better copy_file. 7 years ago
set_windows_crt_report_mode.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
template_cost_testing.h add header to help with template testing 6 years ago
test_allocator.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
test_comparisons.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
test_convertible.hpp Update more file headers across all of the LLVM projects in the monorepo 7 years ago
test_iterators.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
test_macros.h [WebAssembly] WASI support for libcxx 7 years ago
test_memory_resource.hpp Update more file headers across all of the LLVM projects in the monorepo 7 years ago
test_workarounds.h [libc++][test] Fix noexcept assertions in variant's get tests 7 years ago
tracked_value.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
truncate_fp.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
type_id.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
unique_ptr_test_helper.h Update more file headers across all of the LLVM projects in the monorepo 7 years ago
user_defined_integral.hpp Update more file headers across all of the LLVM projects in the monorepo 7 years ago
uses_alloc_types.hpp Update more file headers across all of the LLVM projects in the monorepo 7 years ago
variant_test_helpers.hpp Add option to disable variant narrowing conversion changes. 6 years ago
verbose_assert.h Implement filesystem NB comments, relative paths, and related issues. 8 years ago