1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -chain-include %s -chain-include %s -fsyntax-only %s 2*f4a2713aSLionel Sambuc // Just don't crash. 3*f4a2713aSLionel Sambuc #if !defined(RUN1) 4*f4a2713aSLionel Sambuc #define RUN1 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc struct CXXRecordDecl { CXXRecordDecl(int); }; 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc template <typename T, typename U> cast(U u)9*f4a2713aSLionel SambucT cast(U u) { 10*f4a2713aSLionel Sambuc return reinterpret_cast<T&>(u); 11*f4a2713aSLionel Sambuc } 12*f4a2713aSLionel Sambuc test1()13*f4a2713aSLionel Sambucvoid test1() { 14*f4a2713aSLionel Sambuc cast<float>(1); 15*f4a2713aSLionel Sambuc } 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc #elif !defined(RUN2) 18*f4a2713aSLionel Sambuc #define RUN2 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc template <typename T> test2(T)21*f4a2713aSLionel Sambucvoid test2(T) { 22*f4a2713aSLionel Sambuc cast<CXXRecordDecl>(1.0f); 23*f4a2713aSLionel Sambuc } 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc #else 26*f4a2713aSLionel Sambuc test3()27*f4a2713aSLionel Sambucvoid test3() { 28*f4a2713aSLionel Sambuc cast<CXXRecordDecl>(1.0f); 29*f4a2713aSLionel Sambuc test2(1); 30*f4a2713aSLionel Sambuc } 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc #endif 33