1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s 2 3 template<typename T> 4 struct set{}; 5 struct Value { 6 template<typename T> setValue7 void set(T value) {} 8 resolves_to_sameValue9 void resolves_to_same() { 10 Value v; 11 v.set<double>(3.2); 12 } 13 }; resolves_to_different()14void resolves_to_different() { 15 { 16 Value v; 17 // The fact that the next line is a warning rather than an error is an 18 // extension. 19 v.set<double>(3.2); 20 } 21 { 22 int set; // Non-template. 23 Value v; 24 v.set<double>(3.2); 25 } 26 } 27 28 namespace rdar9915664 { 29 struct A { 30 template<typename T> void a(); 31 }; 32 33 struct B : A { }; 34 35 struct C : A { }; 36 37 struct D : B, C { getArdar9915664::D38 A &getA() { return static_cast<B&>(*this); } 39 test_ardar9915664::D40 void test_a() { 41 getA().a<int>(); 42 } 43 }; 44 } 45 46 namespace PR11856 { 47 template<typename T> T end(T); 48 49 template <typename T> Foo()50 void Foo() { 51 T it1; 52 if (it1->end < it1->end) { 53 } 54 } 55 56 template<typename T> T *end(T*); 57 58 class X { }; 59 template <typename T> Foo2()60 void Foo2() { 61 T it1; 62 if (it1->end < it1->end) { 63 } 64 65 X *x; 66 if (x->end < 7) { // expected-error{{no member named 'end' in 'PR11856::X'}} 67 } 68 } 69 } 70