1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc // expected-no-diagnostics 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc // PR5908 5*f4a2713aSLionel Sambuc template <typename Iterator> 6*f4a2713aSLionel Sambuc void Test(Iterator it) { 7*f4a2713aSLionel Sambuc *(it += 1); 8*f4a2713aSLionel Sambuc } 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc namespace PR6045 { 11*f4a2713aSLionel Sambuc template<unsigned int r> 12*f4a2713aSLionel Sambuc class A 13*f4a2713aSLionel Sambuc { 14*f4a2713aSLionel Sambuc static const unsigned int member = r; 15*f4a2713aSLionel Sambuc void f(); 16*f4a2713aSLionel Sambuc }; 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc template<unsigned int r> 19*f4a2713aSLionel Sambuc const unsigned int A<r>::member; 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc template<unsigned int r> 22*f4a2713aSLionel Sambuc void A<r>::f() 23*f4a2713aSLionel Sambuc { 24*f4a2713aSLionel Sambuc unsigned k; 25*f4a2713aSLionel Sambuc (void)(k % member); 26*f4a2713aSLionel Sambuc } 27*f4a2713aSLionel Sambuc } 28*f4a2713aSLionel Sambuc 29*f4a2713aSLionel Sambuc namespace PR7198 { 30*f4a2713aSLionel Sambuc struct A 31*f4a2713aSLionel Sambuc { 32*f4a2713aSLionel Sambuc ~A() { } 33*f4a2713aSLionel Sambuc }; 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc template<typename T> 36*f4a2713aSLionel Sambuc struct B { 37*f4a2713aSLionel Sambuc struct C : A {}; 38*f4a2713aSLionel Sambuc void f() 39*f4a2713aSLionel Sambuc { 40*f4a2713aSLionel Sambuc C c = C(); 41*f4a2713aSLionel Sambuc } 42*f4a2713aSLionel Sambuc }; 43*f4a2713aSLionel Sambuc } 44*f4a2713aSLionel Sambuc 45*f4a2713aSLionel Sambuc namespace PR7724 { 46*f4a2713aSLionel Sambuc template<typename OT> int myMethod() 47*f4a2713aSLionel Sambuc { return 2 && sizeof(OT); } 48*f4a2713aSLionel Sambuc } 49*f4a2713aSLionel Sambuc 50*f4a2713aSLionel Sambuc namespace test4 { 51*f4a2713aSLionel Sambuc template <typename T> T *addressof(T &v) { 52*f4a2713aSLionel Sambuc return reinterpret_cast<T*>( 53*f4a2713aSLionel Sambuc &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); 54*f4a2713aSLionel Sambuc } 55*f4a2713aSLionel Sambuc } 56*f4a2713aSLionel Sambuc 57*f4a2713aSLionel Sambuc namespace test5 { 58*f4a2713aSLionel Sambuc template <typename T> class chained_map { 59*f4a2713aSLionel Sambuc int k; 60*f4a2713aSLionel Sambuc void lookup() const { 61*f4a2713aSLionel Sambuc int &v = (int &)k; 62*f4a2713aSLionel Sambuc } 63*f4a2713aSLionel Sambuc }; 64*f4a2713aSLionel Sambuc } 65*f4a2713aSLionel Sambuc 66*f4a2713aSLionel Sambuc namespace PR8795 { 67*f4a2713aSLionel Sambuc template <class _CharT> int test(_CharT t) 68*f4a2713aSLionel Sambuc { 69*f4a2713aSLionel Sambuc int data [] = { 70*f4a2713aSLionel Sambuc sizeof(_CharT) > sizeof(char) 71*f4a2713aSLionel Sambuc }; 72*f4a2713aSLionel Sambuc return data[0]; 73*f4a2713aSLionel Sambuc } 74*f4a2713aSLionel Sambuc } 75*f4a2713aSLionel Sambuc 76*f4a2713aSLionel Sambuc template<typename T> struct CastDependentIntToPointer { 77*f4a2713aSLionel Sambuc static void* f() { 78*f4a2713aSLionel Sambuc T *x; 79*f4a2713aSLionel Sambuc return ((void*)(((unsigned long)(x)|0x1ul))); 80*f4a2713aSLionel Sambuc } 81*f4a2713aSLionel Sambuc }; 82