1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
// { dg-do run } // Postfix expression must be evaluated even if accessing a static member. struct S { static int i; S* foo(); }; S* S::foo(){ i = 0; return this; } int S::i = 1; int main(void) { S * s = new S; int k=(s->foo())->i; return k; }