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