-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[libc++] P1789R3: Library Support for Expansion Statements #167184
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
Open
Tsche
wants to merge
14
commits into
llvm:main
Choose a base branch
from
Tsche:feature/decomposable_intseq
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
032858a
[libc++] P1789R3: Library Support for Expansion Statements
Tsche 7402319
fix formatting issues
Tsche 350a3a1
regenerate <version>
Tsche fd296c5
fix failing test
Tsche e309910
apply review comments
Tsche a795b2c
remove extraneous space
Tsche 2a238dc
address more review comments
Tsche 49c6594
add github issue to documentation, sort includes, minor style changes
Tsche 04a6f5f
rename tests
Tsche b9781f4
rename tests, add noexceptness and return type checks, add structured…
Tsche 94909a3
fix formatting issues
Tsche a7ed542
drop constexpr
Tsche 3e3ab8d
guard p1061 structured bindings behind FTM, add structured binding te…
Tsche 58b8e15
make get nodiscard, add nodiscard test, clean up tests
Tsche 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
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
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/intseq/intseq.binding/integer_seq.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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| // REQUIRES: std-at-least-c++26 | ||
| // <utility> | ||
|
|
||
| // structured binding support for integer_sequence | ||
|
|
||
| #include <tuple> | ||
| #include <utility> | ||
| #include <type_traits> | ||
| #include <cassert> | ||
|
|
||
| #include "test_macros.h" | ||
|
|
||
| int main(int, char**) { | ||
Tsche marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| using empty = std::integer_sequence<int>; | ||
| using size4 = std::integer_sequence<int, 9, 8, 7, 2>; | ||
|
|
||
| static_assert(std::tuple_size_v<empty> == 0, "empty size wrong"); | ||
Tsche marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| static_assert(std::tuple_size_v<const empty> == 0, "empty size wrong"); | ||
|
|
||
| static_assert(std::tuple_size_v<size4> == 4, "size4 size wrong"); | ||
| static_assert(std::tuple_size_v<const size4> == 4, "size4 size wrong"); | ||
|
|
||
| static_assert(std::is_same_v<std::tuple_element_t<0, size4>, int>, "size4 type wrong"); | ||
| static_assert(std::is_same_v<std::tuple_element_t<1, size4>, int>, "size4 type wrong"); | ||
| static_assert(std::is_same_v<std::tuple_element_t<2, size4>, int>, "size4 type wrong"); | ||
| static_assert(std::is_same_v<std::tuple_element_t<3, size4>, int>, "size4 type wrong"); | ||
|
|
||
| static_assert(std::is_same_v<std::tuple_element_t<0, const size4>, int>, "const4 type wrong"); | ||
| static_assert(std::is_same_v<std::tuple_element_t<1, const size4>, int>, "const4 type wrong"); | ||
| static_assert(std::is_same_v<std::tuple_element_t<2, const size4>, int>, "const4 type wrong"); | ||
| static_assert(std::is_same_v<std::tuple_element_t<3, const size4>, int>, "const4 type wrong"); | ||
|
|
||
| constexpr static size4 seq4{}; | ||
| static_assert(get<0>(seq4) == 9, "size4 element 0 wrong"); | ||
| static_assert(get<1>(seq4) == 8, "size4 element 1 wrong"); | ||
| static_assert(get<2>(seq4) == 7, "size4 element 2 wrong"); | ||
| static_assert(get<3>(seq4) == 2, "size4 element 3 wrong"); | ||
|
|
||
| return 0; | ||
| } | ||
26 changes: 26 additions & 0 deletions
26
libcxx/test/std/utilities/intseq/intseq.binding/integer_seq.verify.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,26 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| // REQUIRES: std-at-least-c++26 | ||
| // <utility> | ||
|
|
||
| // Expect failures for tuple_element and get with empty integer_sequence | ||
|
|
||
| #include <utility> | ||
|
|
||
| void f() { | ||
| using test1 = typename std::tuple_element<0, std::integer_sequence<int>>:: | ||
| type; // expected-error-re@*:* {{static assertion failed{{.*}}Index out of bounds in std::tuple_element<> (std::integer_sequence)}} | ||
| using test2 = typename std::tuple_element<0, const std::integer_sequence<int>>:: | ||
| type; // expected-error-re@*:* {{static assertion failed{{.*}}Index out of bounds in std::tuple_element<> (const std::integer_sequence)}} | ||
|
|
||
| auto empty = std::integer_sequence<int>(); | ||
| // expected-error-re@*:* {{static assertion failed{{.*}}Index out of bounds in std::get<> (std::integer_sequence)}} | ||
| // expected-error-re@*:* {{invalid index 0 for pack {{.*}} of size 0}} | ||
| (void)std::get<0>(empty); | ||
Tsche marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
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
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.