gcc/testsuite/g++.old-deja/g++.other/static16.C
raw| 1 | // { dg-do run } |
| 2 | // Test that we properly evaluate the object parameter when accessing static |
| 3 | // members. |
| 4 | |
| 5 | struct A { |
| 6 | static void f () {} |
| 7 | static int i; |
| 8 | }; |
| 9 | |
| 10 | int A::i; |
| 11 | |
| 12 | int c = 0; |
| 13 | |
| 14 | A g () |
| 15 | { |
| 16 | ++c; |
| 17 | return A(); |
| 18 | } |
| 19 | |
| 20 | int main () |
| 21 | { |
| 22 | g().f(); |
| 23 | g().i = 42; |
| 24 | return (c != 2); |
| 25 | } |