Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm-only %s |
John McCall | b681b61 | 2009-11-22 02:49:43 +0000 | [diff] [blame] | 2 | |
| 3 | // Tests that Sema properly creates member-access expressions for |
| 4 | // these instead of bare FieldDecls. |
| 5 | |
| 6 | struct Foo { |
| 7 | int myvalue; |
| 8 | |
| 9 | // We have to override these to get something with an lvalue result. |
| 10 | int &operator++(int); |
| 11 | int &operator--(int); |
| 12 | }; |
| 13 | |
| 14 | struct Test0 { |
| 15 | Foo memfoo; |
| 16 | int memint; |
| 17 | int memarr[10]; |
| 18 | Test0 *memptr; |
| 19 | struct MemClass { int a; } memstruct; |
| 20 | int &memfun(); |
| 21 | |
| 22 | void test() { |
| 23 | int *p; |
| 24 | p = &Test0::memfoo++; |
| 25 | p = &Test0::memfoo--; |
| 26 | p = &Test0::memarr[1]; |
| 27 | p = &Test0::memptr->memint; |
| 28 | p = &Test0::memstruct.a; |
| 29 | p = &Test0::memfun(); |
| 30 | } |
| 31 | }; |
| 32 | |
| 33 | void test0() { |
| 34 | Test0 mytest; |
| 35 | mytest.test(); |
| 36 | } |