• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // Check that PSTL algorithms are marked [[nodiscard]] as a conforming extension
10 
11 // UNSUPPORTED: libcpp-has-no-incomplete-pstl
12 
13 // UNSUPPORTED: c++03, c++11, c++14
14 
15 // clang-format off
16 
17 #include <algorithm>
18 #include <execution>
19 #include <iterator>
20 
test()21 void test() {
22   int a[] = {1};
23   auto pred = [](auto) { return false; };
24   std::all_of(std::execution::par, std::begin(a), std::end(a), pred);         // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
25   std::any_of(std::execution::par, std::begin(a), std::end(a), pred);         // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
26   std::none_of(std::execution::par, std::begin(a), std::end(a), pred);        // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
27   std::is_partitioned(std::execution::par, std::begin(a), std::end(a), pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
28 }
29