diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/static16.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/static16.C | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/static16.C b/gcc/testsuite/g++.old-deja/g++.other/static16.C new file mode 100644 index 000000000..6425814d0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/static16.C @@ -0,0 +1,25 @@ +// { dg-do run } +// Test that we properly evaluate the object parameter when accessing static +// members. + +struct A { + static void f () {} + static int i; +}; + +int A::i; + +int c = 0; + +A g () +{ + ++c; + return A(); +} + +int main () +{ + g().f(); + g().i = 42; + return (c != 2); +} |