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 // <iterator>
10 
11 // template<class NotAnIterator>
12 // struct iterator_traits
13 // {
14 // };
15 
16 #include <iterator>
17 
18 struct not_an_iterator
19 {
20 };
21 
22 template <class T>
23 struct has_value_type
24 {
25 private:
26     struct two {char lx; char lxx;};
27     template <class U> static two test(...);
28     template <class U> static char test(typename U::value_type* = 0);
29 public:
30     static const bool value = sizeof(test<T>(0)) == 1;
31 };
32 
33 int main(int, char**)
34 {
35     typedef std::iterator_traits<not_an_iterator> It;
36     static_assert(!(has_value_type<It>::value), "");
37 
38   return 0;
39 }
40