summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/ptrmem5.C
blob: 639ad2831c0af596d0ae5636b6af1b5aef01f5b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// PR tree-opt/18904
// { dg-do compile }
// { dg-options "-O3" }

struct Data;
struct Wrapper {
  Data* D;
};
struct Data {
  int X;
  void init(Wrapper&);
};
void Data::init( Wrapper &w ) {
  int Data::* res  = &Data::X;
  w.D = this;
  for( int i = 0; i < 4; i++ )
    (w.D->*res) = 0;
}