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