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