Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -emit-llvm -o %t |
Anders Carlsson | da921fd | 2009-10-19 18:14:28 +0000 | [diff] [blame] | 2 | |
| 3 | // PR5248 |
| 4 | namespace PR5248 { |
| 5 | struct A { |
| 6 | void copyFrom(const A &src); |
| 7 | void addRef(void); |
Douglas Gregor | f2a5539 | 2009-12-22 22:47:22 +0000 | [diff] [blame] | 8 | |
| 9 | A& operator=(int); |
Anders Carlsson | da921fd | 2009-10-19 18:14:28 +0000 | [diff] [blame] | 10 | }; |
| 11 | |
| 12 | void A::copyFrom(const A &src) { |
| 13 | ((A &)src).addRef(); |
| 14 | } |
| 15 | } |
| 16 | |
Douglas Gregor | f2a5539 | 2009-12-22 22:47:22 +0000 | [diff] [blame] | 17 | // reinterpret_cast to self |
| 18 | void test(PR5248::A* a) { |
| 19 | reinterpret_cast<PR5248::A&>(*a) = 17; |
| 20 | } |