summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp
Commit message (Collapse)AuthorAgeFilesLines
* libcxx: Rename .hpp files in libcxx/test/support to .hNico Weber2019-08-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | LLVM uses .h as its extension for header files. Files renamed using: for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done References to the files updated using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do a=$(basename $f); echo $a; rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/"; done HPP include guards updated manually using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do echo ${f%.hpp}.h ; done | xargs mvim Differential Revision: https://reviews.llvm.org/D66104 llvm-svn: 369481
* Add option to disable variant narrowing conversion changes.Eric Fiselier2019-07-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 365960
* [libc++] Recommit r363692 to implement P0608R3Zhihao Yuan2019-06-201-1/+58
| | | | | | | | | | | | Re-apply the change which was reverted in r363764 as-is after breakages being resolved. Thanks Eric Fiselier for working hard on this. See also: https://bugs.llvm.org/show_bug.cgi?id=42330 Differential Revision: https://reviews.llvm.org/D44865 llvm-svn: 363993
* [libc++] Revert r363692 which implements P0608R3Zhihao Yuan2019-06-191-58/+1
| | | | | | | The change caused a large number of compiler failures in Google's codebase. People need time to evaluate the impact. llvm-svn: 363764
* [libc++] Implement P0608R3 - A sane variant converting constructorZhihao Yuan2019-06-181-1/+58
| | | | | | | | | | | | | | | | | | Summary: Prefer user-defined conversions over narrowing conversions and conversions to bool. References: http://wg21.link/p0608 Reviewers: EricWF, mpark, mclow.lists Reviewed By: mclow.lists Subscribers: zoecarver, ldionne, libcxx-commits, cfe-commits, christof Differential Revision: https://reviews.llvm.org/D44865 llvm-svn: 363692
* [libc++] Fix XFAILs on macOS when exceptions are disabledLouis Dionne2019-02-051-1/+1
| | | | | | | | Some tests are marked as failing on platforms where the dylib does not provide the required exception classes. However, when testing with exceptions disabled, those tests shouldn't be marked as failing. llvm-svn: 353210
* [libcxx] Start defining lit features for tests depending on availabilityLouis Dionne2019-02-051-7/+1
| | | | | | | | | | | | | | | | | This patch removes some vendor-specific availability XFAILs from the test suite. In the future, when a new feature is introduced in the dylib, an availability macro should be created and a matching lit feature should be created. That way, the test suite can XFAIL whenever the implementation lacks the necessary feature instead of being cluttered by vendor-specific annotations. Right now, those vendor-specific annotations are still somewhat cluttering the test suite by being in `config.py`, but at least they are localized. In the future, we could design a way to define those less intrusively or even automatically based on the availability macros that already exist in <__config>. llvm-svn: 353201
* Support tests in freestandingJF Bastien2019-02-041-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* [libcxx] Add availability markup for bad_optional_access, bad_variant_access ↵Louis Dionne2018-11-191-6/+7
| | | | | | | | | | | | and bad_any_cast Reviewers: dexonsmith, EricWF Subscribers: christof, arphaman, libcxx-commits Differential Revision: https://reviews.llvm.org/D53256 llvm-svn: 347219
* Implement LWG 2904.Michael Park2017-06-071-26/+0
| | | | | | | | | | | | | | | | | | | Summary: - Removed the move-constructibe requirement from copy-assignable. - Updated `__assign_alt` such that we direct initialize if `_Tp` can be `nothrow`-constructible from `_Arg`, or `_Tp`'s move construction can throw. Otherwise, construct a temporary and move it. - Updated the tests to remove the pre-LWG2904 path. Depends on D32671. Reviewers: EricWF, CaseyCarter Reviewed By: EricWF Differential Revision: https://reviews.llvm.org/D33965 llvm-svn: 304891
* [test] Test changes to accommodate LWG 2904 "Make variant move-assignment ↵Casey Carter2017-06-071-4/+54
| | | | | | | | | | more exception safe" Also: Move constexpr / triviality extension tests into the std tree and make them conditional on _LIBCPP_VERSION / _MSVC_STL_VERSION. https://reviews.llvm.org/D32671 llvm-svn: 304847
* Add markup for libc++ dylib availabilityMehdi Amini2017-05-041-0/+7
| | | | | | | | | | | | | | | Libc++ is used as a system library on macOS and iOS (amongst others). In order for users to be able to compile a binary that is intended to be deployed to an older version of the platform, clang provides the availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_ that can be placed on declarations to describe the lifecycle of a symbol in the library. See docs/DesignDocs/AvailabilityMarkup.rst for more information. Differential Revision: https://reviews.llvm.org/D31739 llvm-svn: 302172
* Implement C++17 <variant>. Patch from Michael Park!Eric Fiselier2016-12-021-3/+3
| | | | | | This patch was reviewed as https://reviews.llvm.org/D23263. llvm-svn: 288547
* Add <variant> tests but disable them for libc++Eric Fiselier2016-11-231-0/+232
llvm-svn: 287728
OpenPOWER on IntegriCloud