Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / member-pointers-2.cpp
blob6c39282e5a31bbfa0b18b57a1285db4ff9e9b794
1 // RUN: %clang_cc1 -emit-llvm-only %s
3 // Tests that Sema properly creates member-access expressions for
4 // these instead of bare FieldDecls.
6 struct Foo {
7 int myvalue;
9 // We have to override these to get something with an lvalue result.
10 int &operator++(int);
11 int &operator--(int);
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();
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();
33 void test0() {
34 Test0 mytest;
35 mytest.test();
38 namespace rdar9065289 {
39 typedef void (*FuncPtr)();
40 struct X0 { };
42 struct X1
44 X0* x0;
45 FuncPtr X0::*fptr;
48 void f(X1 p) {
49 (p.x0->*(p.fptr))();