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