1 | // RUN: %clang_cc1 %s -verify |
2 | // PR11358 |
3 | |
4 | namespace test1 { |
5 | template<typename T> |
6 | struct container { |
7 | class iterator {}; |
8 | iterator begin() { return iterator(); } |
9 | }; |
10 | |
11 | template<typename T> |
12 | struct Test { |
13 | typedef container<T> Container; |
14 | void test() { |
15 | Container::iterator i = c.begin(); // expected-error{{missing 'typename'}} |
16 | } |
17 | Container c; |
18 | }; |
19 | } |
20 | |
21 | namespace test2 { |
22 | template <typename Key, typename Value> |
23 | class hash_map { |
24 | class const_iterator { void operator++(); }; |
25 | const_iterator begin() const; |
26 | const_iterator end() const; |
27 | }; |
28 | |
29 | template <typename KeyType, typename ValueType> |
30 | void MapTest(hash_map<KeyType, ValueType> map) { |
31 | for (hash_map<KeyType, ValueType>::const_iterator it = map.begin(); // expected-error{{missing 'typename'}} |
32 | it != map.end(); it++) { |
33 | } |
34 | } |
35 | } |
36 | |
37 | namespace test3 { |
38 | template<typename T> |
39 | struct container { |
40 | class iterator {}; |
41 | }; |
42 | |
43 | template<typename T> |
44 | struct Test { |
45 | typedef container<T> Container; |
46 | void test() { |
47 | Container::iterator const i; // expected-error{{missing 'typename'}} |
48 | } |
49 | Container c; |
50 | }; |
51 | } |
52 | |