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