Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -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 | |
| 8 | #if 0 |
| 9 | // FIXME: Uncomment when C++ is supported more. |
| 10 | struct A { |
| 11 | virtual ~A() {} |
| 12 | }; |
| 13 | |
| 14 | struct B : public A { |
| 15 | }; |
| 16 | |
| 17 | struct B *dynamic_cast_test(struct A *a) |
| 18 | { |
| 19 | return dynamic_cast<struct B*>(a); |
| 20 | } |
| 21 | #endif |
| 22 | |
| 23 | char *reinterpret_cast_test() |
| 24 | { |
| 25 | return reinterpret_cast<char*>(0xdeadbeef); |
| 26 | } |
| 27 | |
| 28 | double static_cast_test(int i) |
| 29 | { |
| 30 | return static_cast<double>(i); |
| 31 | } |
Argyrios Kyrtzidis | b348b81 | 2008-08-16 19:45:32 +0000 | [diff] [blame] | 32 | |
| 33 | char postfix_expr_test() |
| 34 | { |
| 35 | return reinterpret_cast<char*>(0xdeadbeef)[0]; |
Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 36 | } |