-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! WIP: [libc++][ranges] Implement
ranges::stride_view
.
Updating tests based on feedback. Signed-off-by: Will Hawkins <[email protected]>
- Loading branch information
Showing
5 changed files
with
81 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
45 changes: 45 additions & 0 deletions
45
libcxx/test/libcxx/ranges/range.adaptors/range.stride.view/base.nodiscard.verify.cpp
This file contains 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,45 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// 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 | ||
|
||
// Test that appropriate (member) functions are properly marked no_discard | ||
|
||
#include <ranges> | ||
|
||
#include "../../../../std/ranges/range.adaptors/range.stride.view/types.h" | ||
|
||
void test() { | ||
const int range[] = {1, 2, 3}; | ||
|
||
std::views::stride( // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
range, 2); | ||
range | std::views::stride( // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
2); | ||
std::views::all | // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
std::views::stride( | ||
1); | ||
|
||
auto sv = std::views::stride(range, 2); | ||
const auto const_sv = std::views::stride(range, 2); | ||
auto unsimple_sv = std::views::stride(UnsimpleConstView{}, 2); | ||
|
||
const_sv.base(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
std::move(sv).base(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
|
||
const_sv.stride(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
|
||
const_sv.begin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
unsimple_sv.begin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
|
||
const_sv.end(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
unsimple_sv.end(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
|
||
sv.size(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
const_sv.size(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} | ||
} |
This file contains 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 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 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