blob: 4b3b82c0297539bd71176607abc85109c411662b [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -emit-llvm-only %s
John McCallb681b612009-11-22 02:49:43 +00002
3// Tests that Sema properly creates member-access expressions for
4// these instead of bare FieldDecls.
5
6struct 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
14struct 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
33void test0() {
34 Test0 mytest;
35 mytest.test();
36}