blob: a1069dee7aefe857ad938f4d548cb3afc9d455b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <algorithm>
// template<ForwardIterator Iter>
// max_element(Iter first, Iter last);
#include <algorithm>
#include <cassert>
#include "test_iterators.h"
int main() {
int arr[] = {1, 2, 3};
const int *b = std::begin(arr), *e = std::end(arr);
typedef input_iterator<const int*> Iter;
{
// expected-error@algorithm:* {{"std::min_element requires a ForwardIterator"}}
std::min_element(Iter(b), Iter(e));
}
{
// expected-error@algorithm:* {{"std::max_element requires a ForwardIterator"}}
std::max_element(Iter(b), Iter(e));
}
{
// expected-error@algorithm:* {{"std::minmax_element requires a ForwardIterator"}}
std::minmax_element(Iter(b), Iter(e));
}
}
|