1 | // RUN: %clang_cc1 %s -emit-llvm -o %t |
---|---|
2 | |
3 | // PR5248 |
4 | namespace PR5248 { |
5 | struct A { |
6 | void copyFrom(const A &src); |
7 | void addRef(void); |
8 | |
9 | A& operator=(int); |
10 | }; |
11 | |
12 | void A::copyFrom(const A &src) { |
13 | ((A &)src).addRef(); |
14 | } |
15 | } |
16 | |
17 | // reinterpret_cast to self |
18 | void test(PR5248::A* a) { |
19 | reinterpret_cast<PR5248::A&>(*a) = 17; |
20 | } |
21 |