-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[libc++][variant] P2637R3: Member visit (std::variant)
#76447
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
Merged
Zingam
merged 43 commits into
llvm:main
from
H-G-Hristov:hgh/libcxx/P2637R3-member-visit-variant
Jan 21, 2024
Merged
Changes from 41 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
f8c52dc
[libc++][variant] P2637R3 - Member visit
Zingam c216ed8
Merge branch 'main' into task/hgh/P2637R3-member-visit
Zingam 1310b54
Merge branch 'main' into task/hgh/P2637R3-member-visit
Zingam 68075dd
WIP: Test via macro
Zingam 0bc0832
WIP: visit.pass
Zingam 1de898e
template_argument
Zingam a52349b
Implemented missing `visit` constraint + test
Zingam 9b7064d
WIP: Updated visit tests
Zingam 2d47529
WIP: tests
Zingam 55516cd
WIP: more test refactoring
Zingam 5097751
Completed: visit_return_type.pass
Zingam 653ec7a
Syn cleanup
Zingam 9126f03
Fixed formatting
Zingam ae8a8d6
Restored original files
Zingam 4d3ff8b
Renamed files and cleanup
Zingam 78f5d3e
Fixed: member.visit_return_type.pass.cpp
Zingam 1bcbb51
Fixed: member.visit.pass.cpp
Zingam 5df0fea
Formatted: visit.return_type.pass.cpp and visit.robust_against_adl.pa…
Zingam 8eaaa41
Addressed comments
Zingam 8f43a47
Merge branch 'main' into hgh/libcxx/P2637R3-member-visit-variant
Zingam 38e8f43
Removed test case
Zingam 6de98f3
Addressed comment
Zingam 759e0d5
WIP: Experiment with forward declaration
Zingam 0a99bd9
Used forward declaration: `std::visit`
Zingam ed7bc12
Moved member `visit` to a separate folder.
Zingam ec32eb5
Merge branch 'main' into hgh/libcxx/P2637R3-member-visit-variant
Zingam fde8ea9
Applied frederick-vs-ja's suggestion
Zingam 47b09d3
Merge branch 'main' into hgh/libcxx/P2637R3-member-visit-variant
Zingam 989203e
Try to fix CI
Zingam 668f337
Try to fix CI
Zingam 06a2402
Fix CI on AIX and Arm
Zingam 3d760da
Try to fix CI
Zingam b2ced9e
Try to fix CI on AIX
Zingam 9c52e75
Merge branch 'main' into hgh/libcxx/P2637R3-member-visit-variant
H-G-Hristov 059b150
Addressed comments
Zingam 376657c
Merge branch 'main' into hgh/libcxx/P2637R3-member-visit-variant
H-G-Hristov c0dc054
Defined `_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER`
Zingam 3bff454
Unsupport tests on *apple-clang*
Zingam edcdc37
Merge branch 'main' into hgh/libcxx/P2637R3-member-visit-variant
Zingam 8376b45
Fix the mistake
Zingam e68fe51
Fixed formatting
Zingam c056e69
Merge branch 'main' into hgh/libcxx/P2637R3-member-visit-variant
H-G-Hristov fa2cb78
Addressed comments
Zingam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
libcxx/test/std/utilities/variant/variant.visit.member/robust_against_adl.pass.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23 | ||
| // The tested functionality needs deducing this. | ||
| // UNSUPPORTED: clang-16 || clang-17 || apple-clang | ||
H-G-Hristov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // <variant> | ||
|
|
||
| // class variant; | ||
| // template<class Self, class Visitor> | ||
| // constexpr decltype(auto) visit(this Self&&, Visitor&&); // since C++26 | ||
| // template<class R, class Self, class Visitor> | ||
| // constexpr R visit(this Self&&, Visitor&&); // since C++26 | ||
|
|
||
| #include <variant> | ||
|
|
||
| #include "test_macros.h" | ||
|
|
||
| struct Incomplete; | ||
| template <class T> | ||
| struct Holder { | ||
| T t; | ||
| }; | ||
|
|
||
| constexpr bool test(bool do_it) { | ||
| if (do_it) { | ||
| std::variant<Holder<Incomplete>*, int> v = nullptr; | ||
|
|
||
| v.visit([](auto) {}); | ||
| v.visit([](auto) -> Holder<Incomplete>* { return nullptr; }); | ||
| v.visit<void>([](auto) {}); | ||
| v.visit<void*>([](auto) -> Holder<Incomplete>* { return nullptr; }); | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| int main(int, char**) { | ||
| test(true); | ||
| static_assert(test(true)); | ||
|
|
||
| return 0; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.