Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only %s |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 2 | |
| 3 | char *const_cast_test(const char *var) |
| 4 | { |
| 5 | return const_cast<char*>(var); |
| 6 | } |
| 7 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 8 | struct A { |
| 9 | virtual ~A() {} |
| 10 | }; |
| 11 | |
| 12 | struct B : public A { |
| 13 | }; |
| 14 | |
| 15 | struct B *dynamic_cast_test(struct A *a) |
| 16 | { |
| 17 | return dynamic_cast<struct B*>(a); |
| 18 | } |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 19 | |
| 20 | char *reinterpret_cast_test() |
| 21 | { |
| 22 | return reinterpret_cast<char*>(0xdeadbeef); |
| 23 | } |
| 24 | |
| 25 | double static_cast_test(int i) |
| 26 | { |
| 27 | return static_cast<double>(i); |
| 28 | } |
Argyrios Kyrtzidis | b348b81 | 2008-08-16 19:45:32 +0000 | [diff] [blame] | 29 | |
| 30 | char postfix_expr_test() |
| 31 | { |
| 32 | return reinterpret_cast<char*>(0xdeadbeef)[0]; |
Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 33 | } |
John McCall | 51e2a5d | 2010-04-30 03:11:01 +0000 | [diff] [blame^] | 34 | |
| 35 | // This was being incorrectly tentatively parsed. |
| 36 | namespace test1 { |
| 37 | template <class T> class A {}; |
| 38 | void foo() { A<int>(*(A<int>*)0); } |
| 39 | } |